PoisonTap – Exploits locked computers over USB
github.com
github.com
[1] https://en.wikipedia.org/wiki/Samy_Kamkar [2] https://hn.algolia.com/?query=tptacek%20"physical%20access"&...
For scarier thoughts, imagine I know how to control the Intel Management Engine, and attack that instead. That's not covered by FDE.
First, the GRSecurity patchset contains a kernel-level USB whitelist, so you can whitelist only known USB devices. A targeted attacker could attempt to spoof an existing/whitelisted USB device, but it does significantly harden the USB attack surface:
1. https://wiki.gentoo.org/wiki/Allow_only_known_usb_devices
Clearly this only helps Linux people. For those using Linux/BSD/macOS, There's also usbkill, a Python-based antiforensic tool that just kills the computer if a device is inserted/removed that isn't on its whitelist: https://github.com/hephaest0s/usbkill
While this won't stop Samy's box from starting to do its thing, it will at least shut the computer off and mitigate some of the potential damage. usbkill is in the Homebrew repositories for macOS as well. If you have fully encrypted disks and strong passphrases, this is still going to ruin somebody's day trying to use this device.
Actually, the GRSecurity patchset includes a toggle to disable all new usb devices after boot. The whitelist mechanism you're referring to relies only on udev (no kernel patching needed). You can even whitelist by driver to, e.g., allow all usb storage devices by default.
That dhcp is running and assigning addresses while the computer is locked, it the issue IMO.
I sometimes think about building a "USB Condom". There already exist devices that only pass through the power lines, if you want to charge a phone from a dubious plug. However, I would go a step further and try to support data. For example, I would emulate a USB pen drive (with a FAT32 file system), and then mirror the contents of an attached drive. If the attached drive is malicious, it cannot easily attack the host.
Because otherwise you can just get one at e.g. http://int3.cc/products/usbcondoms
I have had one for years (a no-name one, not the one I linked)
I wish to build - or I wish someone would build - a USB condom that passes through USB stick drives, by reading files on one side, and emulating a filesystem on the other.
It's not because I want to be 100% there is no backdoor. Rather I want a minimum of safety when I have to access a USB stick given to me by a stranger.
(Speaking of building your own, simple power-only USB condoms - like you linked to - are actually pretty easy to make. They have been used to teach (SMD) soldering at CCC events, hackerspaces and the like.)
1: conventional computers have no mechanism to indicate what you expect from a USB device, and you can't ask for confirmation that the user wanted to plug in a keyboard, because the user might need that keyboard to confirm hits intention
2: the USB software stack can be attacked at many layers, including firmware, generic OS code and the OS-chosen driver. That software stack varies depending on OS, motherboard, BIOS version, installed drivers etc. A hardware device can provide protection invariant from those factors
I don't know from the top of my head about USB, but for FireWire there was a hack that allowed a malicious device to access all memory (read-write). Basically, a new device is placed on the DMA bus (for speed reasons) with no authentication and can do whatever it wants. There is a proof of concept that unlocks OS X, Windows, and a popular Linux desktop.
There was a USB bug where you could infect some USB controllers with mal-firmware that would spread like a worm! I believe the NSA was actively using this, but I might be mixing things up.
With a condom, a malicious device would have to take over two pieces of hardware, not just one. This is one advantage of a hardware solution.
The other advantage is, if there is an exploit in the USB filter software, the malware lands in my condom (hihi). It would likely have to be adapted to work on it and to move to my PC (the condom is ARM, has no network besides USB, can have a read-only file system, ...).
This wouldn't fully solve this problem, but it might just help protect me from people plugging devices into my machine while it's locked, and could even alert me that the device I thought was just charging has reported itself as a keyboard, despite looking nothing like one.
Additionally you could reject any DHCP lease for a subnet that purports to overlap with the address range of any other directly connected network.
>netsh advfirewall firewall show rule name=all
…
Rule Name: Core Networking – Dynamic Host Configuration Protocol (DHCP-In)
———————————————————————-
Enabled: Yes
Direction: In
Profiles: Domain,Private,Public
Grouping: Core Networking
LocalIP: Any
RemoteIP: LocalSubnet
Protocol: UDP
LocalPort: 68
RemotePort: 67
Edge traversal: No
Action: Allow
Rule Name: Core Networking – Dynamic Host Configuration Protocol (DHCP-Out)
———————————————————————-
Enabled: Yes
Direction: Out
Profiles: Domain,Private,Public
Grouping: Core Networking
LocalIP: Any
RemoteIP: LocalSubnet
Protocol: UDP
LocalPort: 68
RemotePort: 67
Edge traversal: No
Action: Allow
Basically I only allow DHCP from LocalSubnet. Of course according to Microsoft LocalSubnet :
“The keyword localsubnet, which includes all addresses that are on the local computer’s current subnet.”
but how the hell does your computer know “local computer’s current subnet” BEFORE it receives its IP from DHCP server???
Hmm, I think Ill just hardcode this to private subnet (192.168.0.0/16).kextunload /System/Library/Extensions/AppleUSBEthernet.kext
and maybe this one. I don't know if this would impact using your phone as a usb hotspot but it might so keep that in mind:
kextunload /System/Library/Extensions/AppleUSBNetworking.kext
and this one but I'm pretty sure it is in fact required for usb tethering so keep that in mind if you use that:
kextunload /System/Library/Extensions/AppleUSBEthernetHost.kext
I don't remember if they reload on reboot or not but if needed you can reload them with kextload.
Edit: This is for OS X/macOS by the way. And I wish I had a Pi to test with because this is very cool. We owe people that release stuff like this a big thanks because they took it from an idea to implementation and then the big step of creating a usable, shareable project which goes a long way toward increasing awareness.
By default anything stuck into a USB port should be sandboxed and various integrity checks need to be performed before access is allowed.
So even if you follow Samy's recommendation of putting cement on your USB ports, [0] you're still vulnerable to injection and interception.
Moral of the story: encrypt all the things.
You mean, before we started using USB for charging...?
It wouldn't be hard at all to make a convincing looking power adapter with something like PoisonTap baked in.
Yes, suppose you have a mac mini and you plug in USB keyboard, oops it's sandboxed and does not work.
It was a decent (but not very popular) defense against rootkits and attackers being able to dynamically load kernel modules and would also prevent something like this (unless you had the necessary drivers compiled in).
I've been using CONFIG_MODULES=n for years without issue. It can be annoying when you need to use some obscure driver, filesystem or protocol on a one off basis and have to do an emergency recompile just for that, but that's rare (for me at least), and otherwise it's perfectly usable.
But if your box's physical security has been compromised, you're already screwed in any case.
There's a gradient to the screwage, however.
For example, I've encrypted my disk, so someone would need to steal my computer and then try bruteforcing it with some new-fangled graphics card.
With this insanity, I risk someone stealing my unencrypted traffic with a plug-and-play device any time I get up from my desk to pee. Then again, they can already do that with Wireshark.
Lets say you are working in an office and get up to go the loo. You lock your work station. You are expecting that your locked computer will mean that a visitor cannot gain access to it in the few minutes you are away.
They could steal the computer, they could destroy it but slipping something into the port of a locked computer shouldn't give them this sort of access.
I feel that we can do better.
If so -- assuming the user is logged in to {1Password|LastPass} -- just plug this in to their PC after they walked away from their desk and wait for all of their saved credentials to be stolen!
And USB at the heart of it. My old friend, USB.
Why am I not surprised?
"PoisonTap, a $5 tool that invades password-protected computers"
And also clearing your cache won't invalidate all your web sessions that they could have stolen. You'll want to find every site you were logged into, and explicitly log out. Otherwise those stolen cookies will still be valid, unless the website does some sort of channel-id thing to bind cookies to the particular computer (which I'm not sure is possible beyond experimental browser features, and certainly is not common practice)
Any idea where is the list of approved devices is. I'd like to clear my list and then plugin some devices and see if it asks.
But here is what happens:
1. I plug in the new device
2. Dialog box pops up letting me know a new network interface was detected (and to open network preferences to configure the device). The device does show up as en6, it is disabled and there is no network activity.
3. I can click Cancel or open Network Preferences
4. Click to open Network Preferences
5. I have to click the lock, and authenticate as an administrative user
6. I have to click the +
7. I have to select the new network interface by name from the drop-down
8. I have to click OK
9. I have to click Apply
At that point the network interface is brought "up", and it does a DHCP request, and I can use it.
So there are 8 steps to take AFTER plugging in the device before it can start siphoning off any and all of my data. It's not as plug and go as it is made out to be.
----
After adding a device, you can remove it from the list of devices in Network Preferences, and that resets that dialog box letting you know there is a new device.