Hosting backdoors in hardware
blogs.oracle.com
blogs.oracle.com
The idea is to hook the interrupt handler that normally invokes BIOS code for handling hard drive I/O at boot time so it invokes instead code in the PCI device that applies a backdoor patch to the Linux kernel when it is read off the disk. The author explains how to patch the Linux kernel by overwriting an obscure, seldom-used error message string, and provides sample code for a simple kernel patch that will listen for IP packets with an unused protocol number and run any payload delivered via them on a Linux shell with root privileges.
It's scary how straightforward this looks.
Whenever I read things like this, I'm reminded that every day we're trusting our data and privacy to the people who design, build, and distribute all the hardware (and software) we use but didn't create ourselves from scratch.
To paraphrase Ken Thompson, we have little choice but to trust trust.[1]
--
I sometimes say "trust no one", which seems to support that false dichotomy, but I mean to say "Reduce and distribute trust".
Open source code and hardware doesn't remove trust. It reduces the amount of trust required and distributes it among more parties. It makes betrayal harder, more expensive, more temporary, and less destructive. That's not perfect, but that's much, much better.
There's a world of difference between closed source software from MegaCorporatism Inc and open source -- even if an evil genius is still technically capable of sneaking something into a compiler or chip.
From a logistics standpoint, it's easier to break software.
Not good enough. It's possible to insert trojans by changing the dopants on the silicon [1], which can't be detected with the decap-and-scan method. From the paper:
> our dopant Trojans are immune to optical inspection, one of the most important Trojan detection mechanism.
You really need to trust the people making your hardware, full stop. There are too many holes with even a trust-but-verify approach.
A related history was posted on reddit a few days ago, about a user identifying his HP notebook sending away his built-in microphone data [0].
[0]: http://www.reddit.com/r/RTLSDR/comments/1le3if/so_i_discover...
For certain applications, that is not unreasonable. I am sure there are more than a few countries that would be interested in fabbing trustable hardware for their own internal use.
Do you trust all the people that work on your factory, and all the people that touch the design? By the way, do you trust the manager of the factory? And his manager (and so on)?
These are much easier problems to mitigate in practice than "We just bought this hardware from the US, who is not particularly keen on us, and we have absolutely not fucking idea what is in it."
You could probably insert a hardware trojan that scans for specific FPGA elements and backdoors them. But there's a potential that an unrelated recompile could alter your signature. An alert adversary would be an even bigger problem. You're trying to hit a moving target from a stationary platform.
Unfortunately, commercial FPGAs today are notoriously proprietary. So while this idea may have theoretical merit, it is not currently an improvement in practice.
Is a start (still needs manufacturer supplied toolchain for the rest of the steps).
This still kills the desired properties of the system. You need open source tools end-to-end, all the way down to the place-and-route system. A backdoor can be inserted at any point otherwise.
Stepping away from the current state of things, competition in the FPGA space still relies heavily on patents and trade secrets. Until that changes, the proposed approach isn't viable.
I wonder if Xilinx or Altera will ever consider this market space interesting enough to pursue. Unfortunately, my gut says no.
Vulnerabilities like this make it difficult, if not impossible, to trust commercial hardware. The DoD started the Trusted Foundry Program² precisely for this reason.
[1] http://www.cl.cam.ac.uk/~sps32/Silicon_scan_draft.pdf [2] http://www.dmea.osd.mil/trustedic.html
What measures could you employ in the design of your network (both physical/topological and logical) to minimize the effectiveness of these backdoors?
I think it would look similar to how tor diffuses things around the network such that you would need to control a significant number of nodes before being able to discover the identity of a user or the contents of the data bound for that user.
The most obvious answer would be air gaps for absolutely critical systems.
For systems where this is not a viable option, how could you best detect/prevent unauthorized attempts from compromised nodes on your network to 'phone home'?
My first thought would be to establish multiple redundant gateways on the network with completely different software/hardware stacks which would all perform the exact same job of vetting packets coming across the network. Along with another set of computers which also have unique stacks which verify that the gateways are all performing identically and no extra sneaky packets are being sent out thorough one gateway and not others.
It gets worse if you can load custom firmware on a disk drive. (which anyone can do). Then you load your firmware which says its the firmware that the drive had on it when it was shipped, except it has some features for diddling bits in the read cache if certain conditions are met.
Not sure where it ends.
This being said, one of the key issues is that I could expect that a compromised motherboard and controller (for example ethernet controller) should be able to make such changes in ram after the boot process has completed, with or without the help of BIOS. The level of paranoia certainly needs to be stepped up a bit.
You can get most of the security benefits of avoiding loadable modules by setting the sysctl kernel.modprobe (i.e., /proc/sys/kernel/modprobe) to "/bin/false" instead of "/sbin/modprobe", late in the boot process. So everything needed to initialize your hardware is loaded, but anything that an unprivileged user attempts to autoload (like a buggy kernel module for a socket family you've never heard of) fails.
I have a config like this on all the security-sensitive servers I run, which tend to have a few thousand unprivileged users. It's actually a shell script that logs the attempt and then returns false, instead of silently returning false, but "/bin/false" is good enough.
But do note that this is a bit orthogonal to the issue mentioned in the article: the proposed attack involves the victim machine having the kernel and modules intact on disk, but device firmware compromised so that it changes the kernel after it's been loaded into memory.
The real challenge is that once you've compiled a kernel, that's all you've got in terms of support. If you need to add filesystem support, a networking capability, additional driver support, etc., you've got to configure and build a new kernel, and test it, which is distinctly less convenient than autoloading an existing module (or even one you've newly compiled in many cases, on a running kernel).
I seem to recall a kernel option or syscontrol, possibly from OpenBSD/FreeBSD, which prevents loading of additional modules once it's been set. This allows you to boot and load modules, but then no more. If your boot media are read-only, this gives a fairly high level of confidence.
I cannot find a reference though.
echo 1 > /proc/sys/kernel/modules_disabled
http://www.outflux.net/blog/archives/2009/07/31/blocking-module-loading/It seems to me that security updates for the kernel are only a tiny part of what a distro releases as security updates. For something like a dedicated firewall – if I've spent the time to compile my own kernel, I'm unlikely to be running all the userspace software that a distro needs to keep updated/secured. My firewall box (probably) doesn't need to update to fix newly discovered flaws in MySQL or PHP or whatever.
That makes it far more "interesting" working out appropriate protection against high level attacks – fortunately for me it's purely a hypothetical defense, my personal (and professional) stance is that if law enforcement or state level espionage targets me, I'm hosed and will happily turn over passphrases and encryption keys to anyone with a badge (and hopefully a court order), and I assume any of the people who I rely on for security (from my ISP to my VPS provider, my SaaS vendors, my OS vendor, through to my hardware suppliers) will sell me out pretty much instantly if the NSA(/GHCQ/ASIO) ask them to. I can _probably_ trust a RaspberryPi that's never been network connected – but it'd be foolish to assume anything else digital I own isn't trivially vulnerable to the NSA if they cared enough about it.
I'm sitting here in my loungeroom looking at my printer, the PlayStation, the Media Server, a bunch of laptops, a few phones, a couple of iPads, a Mac Mini, the linux box, a RaspberryPi, the cheapo chinese adsl/wifi box, and the old NetGear ethernet switch – and wondering if any of them are taking advantage of the privileged access my home IP address has on a bunch of other internet connected networks?
[1] - http://stewin.org/papers/dimvap15-stewin.pdf
[2] - http://44con.com/talks/#persistent-stealthy-remote-controlle...
I also noticed OP's article is nearly 3 years old, which says something. Time for open hardware schematics!
If all channels of communication are flooded with poisoned messages, it wouldn't matter who / what snoops the data. The poisoning needs to be obvious so that the intended recipient can immediately ignore it. At the same time, it needs to be ubiquitous so that machines can't filter it.
This is a bit like the spam / spam filter arms race.
Another idea could be a reverse captcha. All messages by default could be coded as images. (Hey in fact I think this is a brilliant idea if I say so myself!) Combine that with poisoning, and we can be safe from automated collection for atleast a decade. Combine that with encryption and other security measures and that would be awesome.
In fact I am on a idea spree. What if messages were encoded with a captcha? Enter the captcha to decode the message. This encoding is purely to eliminate automated collectors and indexers.
Spam is easier to tackle since a spammer can be tainted for ever. But a poisoned feed still needs to be processed every single time
This is worse on a larger scale: The same code could be on each hard drive sold in the US. You can't even trust your own computer any more.
Terrifying.
What about detection of that kind of backdoors is being present in your current hardware? It is possible if a backdoor is running? Or, i.e. loading some not very used OS for that kind of validation (i.e. some of the BSDs or a kernel with modules disabled) that could avoid to run the backdoor and being able to do that detection.
This is one reason I never buy hardware p2p off bitcoin trading sites and forums, since it would seem logical to target those buyers who may have stuffed wallets to clean out