10

As Matthew Green puts it, "the NSA has been ... Working with hardware ... vendors to weaken encryption and random number generators." At this stage, however, there is little public knowledge of which specific hardware products have been compromised by such efforts, and in which ways. That makes it difficult to know how to respond to such news, when making purchasing/deployment decisions, if one wishes to avoid using compromised functionality. (A rare case which is publicly "known" is the Dual_EC_DRBG random number generator used by various products, although apparently not by the RdRand instruction available on some Intel CPUs.)

For example, if it were the case that the AES or AES-NI functionality available in some Intel and AMD CPUs has been compromised, but the rest of the CPU behaves expectedly, then avoiding the compromised functionality would not necessitate avoiding those CPUs: it would be sufficient just to avoid using the relevant instructions.

My questions are:

  1. Can that be done in the OpenBSD Cryptographic Framework (OpenBSD/FreeBSD/Illumos/etc) and in the Crypto API (Linux), and if so, how?
  2. Given that:

    • suspect hardware is pointless in cryptographic applications, and
    • on-chip AES or AES-NI is pointless except in cryptographic applications,

    do you think CPUs with AES or AES-NI are now pointless?

  3. Have I got the wrong end of a stick here?
sampablokuper
  • 1,961
  • 1
  • 19
  • 33
  • 1
    "Dual_EC_DRBG random number generator implemented by the RdRand instruction available on some Intel CPUs." I never heard that claim, and it's almost certainly false. The `RdRand` designer claims to use an AES based PRNG and I have seen no evidence to contradict that claim. It's also pretty difficult to run ECC with the performance provided by `RdRand`. – CodesInChaos Dec 03 '13 at 21:55
  • @CodesInChaos right you are. I misread the article, and have amended my question accordingly. – sampablokuper Dec 04 '13 at 17:57

2 Answers2

9

The AES instructions have to produce the proper output. If they were tampered with in a way that changed output, it would be detected very quickly, and there have been no reports of that. This limits the scope of tampering considerably (to side channels and such), and I can't see that being readily exploitable by the NSA.

A random number generator is a different beast. It's possible that while it looks to you and I like a random stream, it has some special property that the NSA can use to predict it. RdRand and Dual_EC_DRBG are both under suspicion.

So a practical step is to use additional random number generator instead of (or in addition to) RdRand. Most crypto libraries already do this, or can be configured to (more info)

That's probably the only reasonable countermeasure. In theory a backdoored CPU can do anything: leak your plaintext directly to the NSA, store your keys permanently on the chip, etc. But there's nothing you can really do about that.

paj28
  • 32,736
  • 8
  • 92
  • 130
  • Thanks. Not that I doubt them, but I'd be grateful for sources to back up your remarks. Here's a start, in relation to "I think most crypto libraries already do this" - it seems that Linux does: http://www.linux-magazine.com/Online/News/Linus-Says-No-Backdoor-in-Linux – sampablokuper Dec 04 '13 at 19:31
  • @sampablokuper I've added another link too – paj28 Dec 05 '13 at 09:07
  • 1
    Again in relation to "I think most crypto libraries already do this" - it seems FreeBSD will soon be going a step further than Linux by [disconnecting RdRand](http://www.theregister.co.uk/2013/12/09/freebsd_abandoning_hardware_randomness/) (and Padlock, which is the VIA equivalent) from /dev/random . – sampablokuper Dec 10 '13 at 15:22
  • The Debian security team is [now discussing this, too](http://lists.debian.org/debian-bsd/2013/12/msg00095.html), especially in relation to [Debian GNU/kFreeBSD](http://www.debian.org/ports/kfreebsd-gnu/). – sampablokuper Dec 14 '13 at 23:55
9

There is no way circumvent a malicious CPU.

Malware can run at different layers on modern compute systems. From top to bottom; Application level, user-mode, kernel-mode, boot-sector, firmware and finally microcode. To understand the true significance of these levels, a layperson would first need to understand the process which occurs every time their machines boot up: Power is applied; a program called the BIOS boot program runs; it's job is to play any microcode updates into the CPU and find the boot device; the boot device runs it's boot-sector; the boot-sector finds the kernel and loads it into memory; the kernel starts the first user-mode process (init or smss); initial user-mode process starts up all the processes. Now that all the computer people are fast asleep from that 101 lesson, everyone else can hopefully understand the significance. The lower you are in that chain of processes, the easier it is to control/modify everything above.

Security professionals are used-to (and downright tired of) dealing with malware at the top 3 levels on a daily basis. The bootsector stuff has caught on in the past few years and everyone knows about stuff like Kon-boot or Vbootkit, etc. but it's still not really widespread. Firmware is even more esoteric. BIOS is a type of firmware, the most advanced type of firmware in most systems. There are only a handful of companies in the world who write these BIOS programs. Most computer manufacturers license their BIOS from these companies. Apple of course makes their own because think different and stuff. BIOS malware would (seemingly) have to be very specifically targeted for a particular version of a particular vendor's release, etc. As far as resources, you have Phrack #66 which outlines how to create malicious VMware and Award BIOS, the Maux firmware project, and in 2009 there was that case of those used Dell servers which had BIOS rootkits. This was the first 'wild' case of a BIOS rootkit. The next major case was Mebroni in 2011.

Now look, not to get political, but anyone who tells you the CPU microcode attacks is the domain of "tin foil" and all that.. these people are naive as hell. They have no idea what an empire does every single day to maintain it's power. They have no idea what sort of things go on in the dark in this world. These are the same people who in 1940 would have said that the atomic bomb is a myth and inconceivable. Absolutely the future of 'cyber-war' aka State Sponsored Cyber Terrorism or state sponsored hacking or whatever you want to call it.. absolutely the 'end all' is malicious CPU Microcode. This is as insidious as you can get. The reasons for pursuing the CPU microcode vector in the context of "cyber war" are the very same reasons why nuclear weapons were developed in the context of kinetic war. Think back to the Second World War and the Manhattan project. If the Atomic bomb, more specifically multistage thermonuclear bomb, is the "end-all" game-changer in the vector of, physical, kinetic war then malicious CPU microcode is it's cyber equivalent. The same vigor an obsession with which nation-states pursued atomic weaponry is likely being applied today in developing the end-all cyber weapon.

Now as I mentioned before the microcode updates don't 'stick.' This means they have to be 'played' into the CPU on each bootup. There are some ways around this however. Anyway, your post is essentially asking how an OS.. which is only kernel level and up can protect you from attacks down on the lower levels like bootsector, firmware such as BIOS or specifically CPU microcode. My suggestion is to use old hardware and don't apply the microcode updates where applicable. Funny enough Intel just released a microcode update for the whole 'i' line not to long back. These updates get packaged in with Microsoft updates on the Windows side. Also the updates are obviously encrypted.. and the encryption algorithm is a tightly held corporate secret. If you're really interested in this type of stuff I can get really deep into it, but I think I've posted enough for here. There are people who have tried to reverse engineer microcode updates.. and other stuff like that.. research/researches.. I can link you to some stuff if you want. Anyway.. IMHOP only a state actor.. pretty much only the USA/Israel could pull off something like this.. anyway.. the MIPS architecture CPUs coming out China look promising. Depending on the way this war on general computation goes I might switch to MIPS 100% in the future. Besides, it run's Linux.

Just consider that yes, according to many attributable and non-attributable sources, the NSA is indeed working on the microcode vector.. and YES they ARE working WITH the vendors themselves.. namely Intel. Don't take my word for it.. Steve Blank a well know and well respected silicon valley insider came out earlier this year with a hot-button article which has been dismissed by many of naive types I described earlier. In the articles he outright says straight up.. The US government and Intel are working together on malicious microcode. And from the perspective of the NSA, it makes perfect sense to do so.

Anonymous
  • 149
  • 4
  • Good point about microcode. There has been some discussion of this on the Debian-security mailing list [recently](http://lists.debian.org/debian-security/2013/09/threads.html#00027). – sampablokuper Dec 04 '13 at 20:39
  • 1
    Yes. Also check out the white paper released on fuzzing AMD Opteron microcode. If you do some entropy analysis of the microcode you see the Intel is always encrypted, but the AMD microcode..well was another story. This is the only publicly available whitepaper on this topic I know of. They successfully implemented microcode which would reboot the processor.. like over and over.. they released sample code of that. Also another one which would burn the CPU out.. a permanent DOS.. killing the chip from the inside. [here](http://www.securiteam.com/securityreviews/5FP0M1PDFO.html) – Anonymous Dec 04 '13 at 22:04
  • 1
    Also, I see you edited my post to add a link to Steve's article. It wasn't just published in the Huff Post like you linked (I see you're British so that makes sense!) It was also published by ab bunch of other outlets such as [Forbes](http://www.forbes.com/sites/steveblank/2013/07/15/your-computer-may-already-be-hacked-nsa-inside/) and a bunch of other articles written about the article itself. – Anonymous Dec 04 '13 at 22:11