Why the Security of USB Is Fundamentally Broken
wired.com
wired.com
Check out all the things that a USB device can claim to be.[1] You don't just need your OS to be secure against a malicious storage device; you need it to be secure against a malicious keyboard and mouse, speaker/microphone/sound card, printer/scanner, CNC machine, webcam, ethernet or wifi adapter, bluetooth adapter, infrared adapter, RNDIS adapter (whatever the heck that is, but it's supported by BSD as well as Windows), an ActiveSync device, a smart card reader, a fingerprint reader ...
As I understand it (and I wouldn't mind being wrong), a hostile USB stick could claim to be a hub running all of these at once, and orchestrate them in an attack. Consumer-oriented OSes will happily load up standard drivers to talk to most of them in an attempt to be user-friendly, each with their own hooks into the OS. And the hostile device can detect what OS and probably specific hardware it's talking to,[2] so it can target an attack at the drivers that are likely to exist.
If that's true, I don't see how anyone could be confident that such a stack could ever be secured on the OS side. A secure bulk storage driver is one thing, but your laptop has to be secure against a hostile keyboard working with a hostile CNC machine, sound card, and ethernet device?
At a minimum it seems like devices should be locked at the hardware level to the kind of device that they are. Code signing makes a lot of sense too, although it's sad to lose the (hypothetical?) ability to install alternative drivers.
[1] http://en.wikipedia.org/wiki/USB#Device_classes [2] http://ix.cs.uoregon.edu/~butler/pubs/sadfe11.pdf
It is similar to the scripting languages, Microsoft included into their office products. Before their where also some scripting possibilities in office products, but most of the time not that powerful. When they did it into the most popular office suite existing, the way for a new kind of virus was paved. The universality of office scripting also made the products more vulnerable to attacks.
Discussed in other thread: https://news.ycombinator.com/item?id=8115002
A more granular and hence flexible way to sandbox and handle USB devices will be coming to Qubes by way of Xen's PV USB feature.
Would it not be simple to offer up "non generic" USB port support? That is, the problem is that plugging a USB device could be plugging in a variety of things, which makes it tough. You have to assume that every stack on your machine is hardened against attack.
Instead, make it so that a user can designate that a port can only be used by mass storage devices or keyboards. A basic UI could be devised showing all of the ports and what is expected to be plugged in to them. If something different is actually plugged in, it is not allowed to connect.
That make sense? Something like this already exist?
1) User finds USB stick in parking lot
2) User takes USB stick back to desk and plugs it into workstation
3) Workstation throws up a dialog saying "Hey! I don't recognize that thing you just plugged in! Are you sure you want to let it connect?"
4) User blindly clicks "OK" on dialog without reading it while surfing porn in another window
And, really, if we are concerned with people blindly clicking "OK", I'm not sure of what you can do.
- "USB device 'Kensington 16GB' is trying to take over as your computer's keyboard. Allow?"
- "USB device 'Kensington 16GB' wants read access to your files. Allow?"
- "USB device 'Kensington 16GB' wants write access to your files. Allow?"
The latter two could be more specific about the source/target directories.
‘In this new way of thinking, you have to consider a USB infected and throw it away as soon as it touches a non-trusted computer.’
So now we need a USB abstinence campaign?
When you have a USB with someone, you are having a USB with everyone they had a USB with for the last ten years, and everyone they and their partners have had a USB with for the last ten years.
Also, we're just calling it a USB now? Not a USB thumbdrive, USB hard drive, or whatever? This article sounds like it was written by my mom.
When will you ever update the firmware on your storage device. Never, USB sticks are cheap and disposable. Mass produced ones should have their firmware burned into ROM.
It should not, however, be generally possible for arbitrary programs to update the firmware on a USB device without both the consent of the computer host's current user/administrator AND the device's manufacturer (subject to certain hedges and caviats of course). Right now many USB devices are just wide open, allowing this chaos of security vulnerabilities, that should not be.
What's your risk assessment?
Some places already have a USB abstinence campaign - they remove the ports and do as much as they can to remove the functionality from their OS. Or they remove as many ports as they can and lock other cables in place.
I suppose the fundamental problem is treating the thing on the other end of the wire as a "peripheral" (i.e. inside the computer's logical boundary) rather than as another computer on the end of a network (which might be expected to be hostile).
Firewire and Thunderbolt are much worse: the peripheral has potential DMA access to the whole of system memory. http://support.microsoft.com/kb/2516445
The ability to modify the data as it's copied seems like the only actual vulnerability to me. As in, I write some executable to the USB drive and the firmware modifies the executable to perform other functions. Once the file is copied off of the device though it should be pretty easy to detect such shenanigans with something as simple as a hash check.
You could also have separate flash storage on the device that isn't visible to the OS where you could store whatever data you want but that's less of a concern when you consider that a perhipheral like a keyboard can't record the keystrokes of another perhipheral (not directly, anyway--you'd have to get the user to execute some malware).
However, let's not get too dismissive. I always remember reading about the security problems in firewire for example. These were OS independent. A malicious device could do DMA into the host machine without the OS being able to validate. This type of hardware design issue leading to security problems is not unheard of.
Lastly, printer drivers? Huh? Can you point at an actual Windows feature that is currently shipping or are you thinking of 1990s Windows and autorun? When you plug in a device these days, it will check Windows Update based on the device ID but I am not aware of anything that will trust unverified code coming from elsewhere without the user doing something.
Also, if you configure your USB device to emulate certain other devices those drivers will also be installed automatically via Windows Update. Such drivers may have vulnerabilities or just flat out provide all sorts of privileged access to the system. It's not that complicated, actually... Just change the USB device manufacturer/ID and let Windows compromise itself.
I don't know whether it's possible for such a device to snoop on other devices. I suspect not, unless it is a hub which contains the bad firmware. It might be interesting for capturing passwords, then playing them back later.
Of course any device could compromise the device driver using buffer overflows, etc, to gain control of some aspect of the computer.
Check out this for more information: https://github.com/hak5darren/USB-Rubber-Ducky/wiki
I could do the same with any $5 Arduino Leonardo device (of which I have several).
a) present as keyboard b) windows key terminal enter c) cat >.libevil.so.base64 <<EOF d) dump a base64 library in there e) base64 -d .libevil.so.base64 >.libevil.so f) echo "LD_PRELOAD=~/.libevil.so" >>.bash_profile g) exit h) turn into a USB mass storage device again
USB stacks have been proven to be buggy (one of the PS3 exploits iirc used a modified Android phone giving malformed USB descriptors to the host). Add DMA to the mix and you have root access...
I looked to see if USB could 'do' DMA (similar to i1394) and the general consensus seemed to be that it was in the hands of drivers several layers below what was normally accessible to device developers - so unlikely but perhaps possible if there was an exploit. (It sounds like all DMA by the USB device would have to go through driver software on the computer, instead of direct memory access as is possible with firewire.) http://www.osronline.com/showthread.cfm?link=243802
This all sounds similar to how 3d graphics drivers are a new security frontier as web browsers rush to support arbitrary shaders: any usb device can claim to be something with a 'ships-with-the-OS' exploitable driver (eg. a 10-year-old usb network adapter) and then pop the exploit to run arbitrary code with device driver level access.
The solution will require sandboxing device drivers (in user-space or with virtualization) and will probably affect performance to such a degree that it will have to support opt-out.
I'd just google for ps3 usb exploit, that should give you the iformation.
The DMA stuff was basically just imagination. With Firewire, it has been proven to work as the port itself gives DMA access. USB has something like this not built-in, but most people use the same or similar controller chipsets, so that, like in GSM baseband processors, a single exploit could target loads of devices.
The main problem is that hardware was usually built with full trust in mind... I wonder what Lightning does, given it is essentially a PCI lane in optic wire. Lightning stuff is hellish expensive at the moment, but I'm just waiting...
I don't believe so. It's just a bus and protocol for easily connecting external peripherals and it doesn't look like it does much else.
Others have compared it to networking technologies, but a more apt comparison for its use and design would be the PCI r PCI-E bus. You're connecting things to act as the local machine, by that point you're implicitly trusting them.
However, the one thing that is unique to USB is the nature in which USB storage devices are shared between multiple devices.
That was half of my point. I was not underestimating the vulnerability of SATA and other on-board communications protocols. I was ignoring them because the parts connected to these are generally not moved between machines. Yes, you could infect these devices and hope they spread through the secondary market to a desirable target, but the utility of such an attack is very limited.
I understand the point that USB drives are more, well, promiscuous than other bus hardware, but saying "A thumbdrive with modified firmware can affect a computer it is plugged in to" and equating that with "USB security is fundamentally broken" seems like a bit of a reach. i.e. there is no specific provision in the USB protocol for re-flashing device/USB stack firmware. I think "Certain USB thumbdrive chipsets are vulnerable to a specific exploit that allows the USB host to modify the thumb drive's firmware" is a much more accurate headline, given the content of the article. Right now it is no different than saying "I got a virus over email, therefore Ethernet is fundamentally broken"
1.) You want to trust your USB device. 2.) You want to use your USB device on another non-trusted computers. 3.) Non-trusted computers can update your device's firmware behind your back.
So how can you handle firmware upgrades on your USB without trusting computers? One way to do this is to have an firmware update approval mechanism directly on the device.
For keyboards the mechanism could be the following:
- The computer initiates a firmware update. - The keyboard leds start to blink - You have to enter your keyboard's UUID (which is on the bottom)
Now you only have to make sure that you don't lend your keyboard to someone that you don't trust.
It supported ten finger gestures so basically the sky was the limit in terms of what you could program it to do. It had only one flaw: There was no tactile feedback so it was easy for your hands to get out-of-alignment resulting in incorrect characters being typed pretty often. On the other hand it was much faster to move the cursor around than a regular keyboard so correcting mistakes was less of a hassle.
Unfortunately, the popularity (and honestly the convenience) of USB flash drives has made it hard to switch onto safer mechanisms.
Is it possible (for some or many) USB-sticks or USB devices to reprogram the firmware from an PC that it is connected to it?
The article plays a little with the threat, that I (I want to put it this way:) lent my USB stick to a friend, he uses it, but clears it afterwards and gives it back to me and the stick now contains an infected firmware (that I can not find out by normal means). And also the friend knows nothing, since his computer was infected before.
Of course, I know that it is possible to change a firmware by hw-means (replacing the chip or reprogram it with special hw) but when the firmware of some or all USB-devices would be alterable just by plugging them into a computer, a new kind of virus would be possible spreading more silently and dangerously as all of them before.
HW hacking the firmware of USB devices of course is possible, but would be more in the field of industrial or real espionage. Reprogramming firmware "on-the-run" would cause a new mass-threat for computers.
This is likely because the firmware has not been perfected yet, so ugrades are continuing. Plus completely different characteristics can be obtained to arrive at multiple device brands or behaviors from the same hardware. "Identical" flash drives from the same manufacturer containing the same exact chips can often have different firmware revisions, and different resulting performance.
On most units an additional CDROM device, or extra partitions (hidden, private/secure or not) can be configured to be detected (or not) when plugged in to any OS. The controller provisions the available flash memory among the dictated devices and makes them available to you.
I've been adjusting the firmware for a couple years now as I do the continuous improvement on my rapid multibootable sticks.
It does point out the most glaring flaw in the lack of a security model, though: you should be able to approve or deny a new peripheral connection before the drivers are loaded or DMA is allowed.
Further, USB was designed from the beginning to allow block devices to transfer data. I don't quite get why this means it wasn't designed for data sharing - moving around physical, removable disks was the standard for data sharing for a long time when usb came out - back then most people couldn't reliable send big stuff over the network. The plan was definitely for sharing data.
Basically the security issues come from the shape of the problem rather than a specific implementation of it. For example there's always someone doing "fun" things with network cards - another example of a device with DMA access and a microprocessor. If you can root the network card, you can get access to other parts of the device.
So yeah - usb seems to be particularly easy to break, but it part of a generally hard problem. It would be nice to see a standard that takes the lessons of USB into account, and makes it much harder to break things.
Indeed it can. Bunnie & xobs recently showed how to get code running on the controller chips of SD cards [1]. With your own implementation you could have the card present alternative files (clean vs infected) to different machines based on read patterns [2] or just a mount count. Without an exploit for the kernel, you'd still need the user to click on one the files, however.
That's not to say your suggestion isn't safer; SD cards don't present a threat to HID attacks (where a USB stick pretends to be a keyboard and is trusted to send inputs), but as with anything, it's not totally safe.
[1] : http://www.bunniestudios.com/blog/?p=3554
[2] : http://events.ccc.de/congress/2012/Fahrplan/events/5327.en.h...
However, if it is something else (like, e.g., something that executes code from time to time), isn't it insecure by design?
And if so, why did nobody see it and was it malice or stupidity?
Devices without tokens or with unrecognised tokens would need user approval, those with the correct one would be trusted. That still doesn't solve the problem of deciding if a device should be trusted or not though.
if you are goign to plug unknown hardware into your machine what do you expect