TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

BadUSB – On accessories that turn evil [pdf]

84 pointsby thefreemanalmost 11 years ago

10 comments

cnvogelalmost 11 years ago
I think the &quot;no effective defense&quot; slide (#20) is kind of disappointing. Their whole talk, for me, circles around the &quot;someone plugs in a USB device with surprising functionality&quot; narrative... And there are two possible things that can go on. First, the device could try to exploit flaws in parsing of USB descriptors. This is how the PS2, I think, was sucessfully rooted&#x2F;unlocked&#x2F;made-linux-run-on-it.<p>But the talk linked to mainly focuses on the second possibility: &quot;the OS automatically loads the driver for keyboards and network adapterse&quot;, and this is trivially defended against, at least on Linux. I assume you can do similar&#x2F;identical things on other operating systems (e.g. Windows probably has a registry key for that, because it always has registry keys for everything...)<p><pre><code> # echo 0 &gt;&#x2F;sys&#x2F;bus&#x2F;usb&#x2F;drivers_autoprobe </code></pre> Now, no drivers are bound to USB devices automatically. Just try it. I plugged in peripherals into the computer, the only thing you&#x27;ll get (running 3.15.8-1-ARCH, archlinux x64) is the following text in the dmesg:<p><pre><code> [ 6765.949361] usb 5-1: new low-speed USB device number 3 using uhci_hcd **mouse** [ 6846.469357] usb 6-1: new high-speed USB device number 3 using ehci-pci **harddisk** [ 7062.616021] usb 7-4.4: new high-speed USB device number 7 using ehci-pci **eth&#x2F;network** </code></pre> Now, if I am convinced that one of the devices hasn&#x27;t been tampered with, I&#x27;ll run the following command, that triggers automatic probing for a single USB device (1.0 is configuration 1, function 0, I think...)<p><pre><code> # echo 7-4.4:1.0 &gt;&#x2F;sys&#x2F;bus&#x2F;usb&#x2F;drivers_probe </code></pre> dmesg shows....<p><pre><code> [ 7193.076584] ax88179_178a 7-4.4:1.0 eth0: register &#x27;ax88179_178a&#x27; at usb-0000:00:1d.7-4.4, ASIX AX88179 USB 3.0 Gigabit Ethernet, 00:0a:cd:22:b4:40 [ 7193.099754] systemd-udevd[10470]: renamed network interface eth0 to enp0s29f7u4u4 </code></pre> But if I only want to allow USB storage devices, I can manually bind to the usb storage driver.<p><pre><code> # modprobe usb-storage # was not loaded on my machine, yet... # echo 1 &gt;&#x2F;sys&#x2F;bus&#x2F;usb&#x2F;devices&#x2F;6-1&#x2F;bConfigurationValue # enable 1st configuration # echo 6-1:1.0 &gt;&#x2F;sys&#x2F;bus&#x2F;usb&#x2F;drivers&#x2F;usb-storage&#x2F;bind </code></pre> dmesg, again...<p><pre><code> [ 7583.801824] usbcore: registered new interface driver usb-storage [ 7729.898188] usb-storage 6-1:1.0: USB Mass Storage device detected [ 7729.898404] scsi6 : usb-storage 6-1:1.0 [ 7730.900552] scsi 6:0:0:0: Direct-Access TOSHIBA MK4309MAT G5.0 PQ: 0 ANSI: 0 CCS [ 7730.904913] sd 6:0:0:0: [sdd] 8452080 512-byte logical blocks: (4.32 GB&#x2F;4.02 GiB) </code></pre> Now, this of course is completely ridiculous, from a user-interface perspective, but, I think if you only want to cover mounting of USB sticks, you can script this in shell&#x2F;perl&#x2F;python&#x2F;awk, using &quot;lsusb -v&quot; for parsing the binary USB descriptors and only start usb-storage on USB sticks.<p><i>EDIT</i>&#x2F;<i>ADDED</i>: -----<p>And also note: The mechanism described above concerns the binding of drivers to devices. There&#x27;s a different facility in place to make USB devices inaccessible to the drivers&#x2F;the user, and that&#x27;s using the &quot;authorized&quot; flags: You set the &quot;autorized_default&quot; flag in &#x2F;sys&#x2F;bus&#x2F;usb&#x2F;devices&#x2F;usb&lt;N&gt; to 0, then every device that is connected to the machine is initially disabled:<p><pre><code> [ 9162.809251] usb 7-4.4: new high-speed USB device number 11 using ehci-pci [ 9162.912337] usb 7-4.4: Device is not authorized for usage </code></pre> If you are sure that this particular device is allowed to connect, authorize it...<p><pre><code> # echo 1 &gt;&#x2F;sys&#x2F;bus&#x2F;usb&#x2F;devices&#x2F;7-4.4&#x2F;authorized [ 9214.302656] ax88179_178a 7-4.4:1.0 eth0: register &#x27;ax88179_178a&#x27; at usb-0000:00:1d.7-4.4, ASIX AX88179 USB 3.0 Gigabit Ethernet, 00:0a:cd:22:b4:40 [ 9214.302678] usb 7-4.4: authorized to connect [ 9214.326028] systemd-udevd[10771]: renamed network interface eth0 to enp0s29f7u4u4 </code></pre> That way, you could have the publicly accessible USB connectors (say... usb2 and usb4) in &quot;autorized_default=0&quot; mode, and the internal USB connectors, or the ones on the back of a device that is somewhat physically secured set to &quot;autorized_default=1&quot; to not impede usage and comfort... But, of course, if you have scripts in place implementing a &quot;USB ACL&quot;, that doesn&#x27;t really sound as if it&#x27;s worth the added complexity?
评论 #8168942 未加载
评论 #8167907 未加载
deathanatosalmost 11 years ago
To some extent, this feels like the old &quot;if you have physical access…&quot;¹ rule.<p>It is good to see more awareness of the fact that USB devices can be quite arbitrary things. I remember trying (hard) to convince people that a cell phone was a computer years ago. It&#x27;s basically the same thing: a USB device can certainly house a computer, for some definition of that.<p>It would seem that page 11&#x27;s attack would require that the machine is unlocked and just sitting there. If not, how would it install the keylogger? (It&#x27;d be at the password screen, and input would go there.) Otherwise, this is simply a shortcut to install a keylogger and capture sudo. (Which again brings us back to &quot;physical access&quot;.)<p>Page 13: Are there really that many distros that just DHCP any interface? Gentoo (at least mine, I suppose? it is configured by the user, but I thought I chose the defaults here?) doesn&#x27;t?<p>Page 17: are there boot orders that put USB first? I feel like HDD is almost always first, given the number of times I need to beg for a prompt in BIOSes, but again, maybe just me?<p>However, if anything, the above does show how much of a minefield this is…<p>¹then it&#x27;s really hard to be secure.
评论 #8166890 未加载
评论 #8167110 未加载
评论 #8166994 未加载
评论 #8166878 未加载
raesene3almost 11 years ago
The Video is also up on Youtube and adds quite a bit to the slides including some good demos<p><a href="https://www.youtube.com/watch?v=nuruzFqMgIw&amp;list=UUJ6q9Ie29ajGqKApbLqfBOg" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=nuruzFqMgIw&amp;list=UUJ6q9Ie29a...</a>
leni536almost 11 years ago
Once you can install arbitrary programs on a device (or a single program, the firmware) you should treat these devices with a general mistrust.<p>The main problem here that you can&#x27;t use your usb devices at public places safely, since they can patch your usb device&#x27;s firmware at will. The problem here that you use your trusted usb device on a not-trusted computer which can do anything it wants with your device&#x27;s firmware. There should be an approval mechanism directly, physically on the device to prevent this.<p>For example on usb thumb drives there could be a switch on the device which turns it to &quot;firmware upgrade mode&quot;.
评论 #8167119 未加载
asdffdsajklalmost 11 years ago
Really the key thing to focus in here, IMO, is the fact that arbitrary USB hardware firmware can be overwritten - anything taking place after complete control of the USB hardware has already been exploited and well documented; for example the teensy device and the usb rubber ducky.
iwalton3almost 11 years ago
I can think of 2 solutions to this issue offhand.<p>- Accept general input from a keyboard or mouse only after the user&#x27;s password has been entered into a confirmation window. (Even just a yes&#x2F;no would work here.) - Change all key shortcuts and menus that can execute things (WinKey+R, Alt+F2, etc.) to something nonstandard. You could also remove them altogether or prompt for a password if afraid of a targeted attack.<p>The question then becomes this: Are there other attacks that can use USB to execute code beside mimicking input devices?
评论 #8166831 未加载
sobkasalmost 11 years ago
This remainds me of sd card hacking: <a href="https://www.youtube.com/watch?v=CPEzLNh5YIo" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=CPEzLNh5YIo</a>
canviaalmost 11 years ago
arstechnica article on it: <a href="http://arstechnica.com/security/2014/07/this-thumbdrive-hacks-computers-badusb-exploit-makes-devices-turn-evil/" rel="nofollow">http:&#x2F;&#x2F;arstechnica.com&#x2F;security&#x2F;2014&#x2F;07&#x2F;this-thumbdrive-hack...</a>
biggerfischalmost 11 years ago
Sorry for the silly question, but the slides seemed to indicate that any USB keyboard can read any other keyboard&#x27;s keystrokes? Is that a correct understanding? Otherwise, I don&#x27;t see how they can steal passwords. Am I just missing something obvious?
评论 #8166091 未加载
评论 #8167355 未加载
j_salmost 11 years ago
Here is the speculative discussion from one week ago based on the summary of the talk before it was given at BlackHat today:<p><a href="https://news.ycombinator.com/item?id=8112942" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8112942</a>