278 points · by ivank · 9y ago · 115 comments
There's a mode called "Debug Accessory Mode". This is totally different than normal operation and requires a special cable as a security measure. (In a regular cable, pins A5 and B5 are connected together and there's only one wire in the cable for them. Debug Test devices use a cable where pins A5 and B5 have their own wires and there's a voltage difference between them.) Debug Accessory Mode, once entered, is vendor-specific. It may include JTAG low-level hardware access. Look for exploits based on this. If you find an public charger with an attached USB-C cable, worry. Always use your own cable.
The "security" feature is that you need a nonstandard USB-C cable with an extra wire, and it needs to attach to something that sends JTAG signals.
The Google Pixel supports Debug Accessory Mode.[2]
[1] https://news.ycombinator.com/item?id=12824366 [2] https://plus.google.com/+BensonLeung/posts/XGLDnsF57PB
No JTAG on the Pixel C either, just UARTs and SPI: https://chromium.googlesource.com/chromiumos/platform/ec/+/m...
Given your commend it USB-C specific, and the linked article mentioned USB-3 (which has a USB-2 connector variant) what is the mechanism on those ports for detecting a debugger?
All USB thumbdrives are already a threat. Not just from autoplay/execute, but there are malicious/pentester thumbdrives out there (like the Rubber Ducky) that emulate a USB HID keyboard; computers have absolute trust in keyboards, so you just have a script that instantly types in "Win-R cmd enter <download and run your exploit>".
With direct hardware access/DMA you can just plug a small device into, let's say a locked office cubicle computer and compromize/siphon data off it that way.
Plugging in USB is just as unsafe as about anything else you can use a computer for.
[1] https://youtu.be/QuuTLkZFsug?list=PLOcrXzpA0W82Z49Pj0v-cehuv... [2] https://youtu.be/QuuTLkZFsug?list=PLOcrXzpA0W82Z49Pj0v-cehuv...
Edit: whoops just saw your reply that it can indeed be disabled, and that its enabled by default
Even if there's a hardware switch, it still enables two strike attacks :-/
couldn't you just create a passthrough female/male sleeve that simply internally solders A5 and B5 and use that any time you have to plug in anything untrusted?
https://www.amazon.com/PortaPow-Charge-Block-Adaptor-SmartCh...
In their concluding remarks, the researchers proposed a number of protective measures based on use of Intel's BootGuard feature and forbidding activation of the debugging interface.
Let's not scare ourselves too much, lest we end up in Stallman's debuggers-are-controlled-munitions dystopia. ( https://www.gnu.org/philosophy/right-to-read.en.html )
We cannot simply continue to allow it to be "game over."
Counterexample: For Unclassified and Unclassified//FOUO websites made available on the public internet by DoD/IC, you can even access them from home using a valid CAC/PKI card (smart card holding a client certificate affirming your identity). This is not just informational websites, it includes your unclassified webmail, Intelink-U (web gateway to some sites), and more. They are far more lax than many private corporations are.
Physical security is surely good to have, but your reference to military is not a great one as military and the intelligence community hedge a lot on digital security, not physical security unless the information is highly sensitive (Even then, it is in combination with very strong digital security measures regarding setup of the network, VPN, and all endpoints).
It should not be possible to break into a device simply by having it in your possession for a few minutes. Opening it up? Harder to protect against and therefore a lower priority. But some devices are glued shut and therefore more secure. (This security can be used against the user as well as by the user, but that's a whole other can of worms)
EDIT: Adding this: ( http://www.artima.com/weblogs/viewpost.jsp?thread=23476 )
Of course, it requires you have deterministic logging. If you don't have that, it should be your #1 priority.
Shouldn't a debugger mitigate the necessity of overly paranoid design and testing? Testing hardware is much more expensive than testing software - to do so properly, you first have to build the damn thing. Hardware 'revisions' (builds) are more commonly measured in single digits, not the 6+ digit monsters of your local CI setup.
Another answer: In the exact same sense that bug databases, assertions, unit tests, static analysis, 'safe' programming languages, code reviews, etc. are all mitigations and crutches for the human condition.
A third answer: Crutches are useful medical devices.
A fourth answer: I routinely interact with software and hardware that hasn't undergone proper design and testing. This is a bit of a mouthful, so I generally shorten this to "software" and "hardware", respectively. Why yes, I do debug and workaround 3rd party issues - for which no amount of "proper design" or "testing" of my own stuff will help - regularly enough to need a debugger.
> EDIT: Adding this: ( http://www.artima.com/weblogs/viewpost.jsp?thread=23476 )
To quote from that:
> Once you have exhausted every other avenue of diagnosis, and have given very careful thought to just rewriting the offending code, then you may need a debugger.
Yes, even that admits you'll sometimes need a debugger. Not "want" - need. Even for software.
EDIT: Various typos.
Probably not wise to ship one enabled on production gear, I used to work on things that required some soldering to get access.
See https://events.ccc.de/2015/01/03/the-youtube-and-stream-dump... for a detailed explanation of the problem.
They explained it that way, that it would be a great benefit to debug ECUs via the on-board diagnostics port (ODBII) and may be later even over the internet.
They tried it behind the automotive scene. But we managed to get many major OEMs on board to prevent that standardization effort. This would have been the greatest easter egg for all cars, it that would have been happened.
Remember direct DMA attacks on FireWire, etc.?
SMH.
(Firewire isn't DMA. PCI-E is DMA. Firewire is a network cable, over which software sends packets. LAN over FireWire was sometimes done. But there's an optional feature which recognizes special packets for doing word-size loads and stores. This is usually used to talk to dumb slave devices, where you write "registers" to make things happen. It's not needed on a computer, and it's far too slow for bulk transfers. FireWire isn't inherently more vulnerable than a LAN port.)
I imagine DMA was a trade-off for speed. Security is about such trade-offs.
On the other hand; there is a reason for the age-old adagium that once an attacker has physical access; it's always game-over.
USB is supposed to be an interface that is exposed to the world. Using USB is not quite the same as getting into the box and switching a microswitch.
> “There are several ways someone could do this. An attacker could change the BIOS configuration (for example, with a use of a Flash programmator) when they have physical access to the equipment during manufacturing, storage or usage.
It has to be specifically enabled (with physical access)
If the comments above are correct this is either more like JTAG or is JTAG. That's commonly far more capable, usually providing the ability to do things like read and write arbitrary memory without any kernel hinderance at all (although ARM cpus can typically still protect trustzone memory).
Manufacturers seem to have settled on a few different approaches to JTAG:
1/ Leave it open, hope nobody notices.
2/ Leave it to ARM, since modern ARM CPUs have the ability to disable normal and secure world invasive and noninvasive debugging.
3/ Require you to scan in a secret to unlock most debugging functionality.
4/ Fuse off JTAG on production devices.
I can only speak to my experience, but my guess is that for consumer electronics this is roughly in order of popularity with the top option being maybe half of devices and the bottom maybe 10%.
And each of these has problems, so it's no wonder people haven't figured out just one.
Leaving it open is terrible from a security perspective, but for some classes of devices it's also a legal and IP headache. So this is mostly the "couldn't be bothered" set.
Leaving it to ARM is fine as long as your trusted world is sane and the only interesting thing on the chain is your CPU. For many devices this isn't the case. And sometimes bootloaders etc can be made to be insane.
Scanning in secrets is just a bad idea. Provisioning per device secrets is hard, so the "secret" often isn't. Usually it's either something simple (1111... etc) or a serial number, or a serial number ^ a constant, or just the constant. Even where this isn't the case, the secret checking logic is often glitchable or has a viable timing attack. So these frequently fall into the "annoying but possible" bucket for me.
Fusing off JTAG is a mixed bag. It's a huge PITA for manufacturing and RMA so I understand why people don't do it. And you really have to have kind of a lot of logic running on most devices today to get fuses working, so it isn't always as effective as it looks in the presence of glitching attacks. But it is still by far the best option for security and it can be gotten right.
There are also usually various levels of 'disabled', with some parts letting you run eg mbists even in a secured configuration. Obviously, more special cases means more ways to go wrong.
Of course some segments of the market are better about these things than others, so YMMV on the frequency of various approaches.
To be fair, these are generally fairly well documented for most CPU cores. For the ones that aren't documented, sniffing a proprietary debugger isn't difficult.
The other way is supposedly protected by manual installation and signing keys.
USB Video Class devices can all use the same driver, instead of every new webcam needing it's own special software to work. USB HID devices all use the same driver, so I don't have to know I'd my specific keyboard and mouse are supported.
Nothing wrong with standards. What's wrong is trying to shove everything and the dog into a single standard instead of appropriately separating concerns.
Now we have multiple mutually incompatible USB-C connector based video protocols. This is the result of trying to overspecify the USB standard.