Live data from Hacker News

How secure is Linux's random number generator?

lists.randombit.net

71–80 of 100 posts

Re: How secure is Linux's random number generator?

#71

What does it take to reverse engineer the silicon? I thought I'd seen an project for automating it, but I can't find it.

Even reversing the silicon won't likely help— and, uhh. Reversing a state of the art CPU is not do-at-home stuff.

The reason it won't help is that the design is _explicitly_ microcoded. E.g. RDRAND triggers running loadable microcode which is supposed to read the real RNG and AES it. Maybe there is an unrelated "bug" that allows that microcode to be corrupted after some particular instruction sequence happens. All your investigation would turn up everything looking like normal.

Re: How secure is Linux's random number generator?

#72
The annoying thing is that the Linux RNG is really limiting without something like RdRand.

It used to be that most drivers contributed to the randomness pool, so it seldom ran short. It used to be that you could configure the size of the pool, so if you were running short you could make it larger. But then it was discovered that the pool resizing had a locally exploitable vulnerability so it was removed, leaving it always at the smallest value; and it was realized that many driver sources weren't very random and/or were externally controllable so most were removed.

The end effect is that much server hardware only gets about 50-100 bits per second added only to a pool of 4096, and /dev/random is constantly running out leading to weird performance problems (like ssh connections taking a long time). This results in a desperate need to replace /dev/random with something like RdRand when it could just otherwise be another untrusted contributor if the rest of the system around /dev/random were sane.

Re: How secure is Linux's random number generator?

#74
post #72

The annoying thing is that the Linux RNG is really limiting without something like RdRand. It used to be that most drivers contributed to the randomness pool, so it seldom ran short. It used to be that you could configure the size of the pool, so if you were running short you could make it larger. But then it was discovered that the pool resizing had a locally exploitable vulnerability so it was removed, leaving it a…

Apparently, for some "security experts" it's damned if you do, damned if you don't

If you don't use RdRand then you have few sources of "true" randomness, hence, your RNG is predictable, manipulable and you're an idiot and a 5 year old can break your crypto

If you use RdRand then "blah blah blah this is opaque", hence, your RNG is predictable, manipulable and you're an idiot and a 5 year old can break your crypto

Perfect solutions exist only in labs and my impression is that most of these "experts" make things less secure.

Re: How secure is Linux's random number generator?

#75
post #71

What does it take to reverse engineer the silicon? I thought I'd seen an project for automating it, but I can't find it.

Even reversing the silicon won't likely help— and, uhh. Reversing a state of the art CPU is not do-at-home stuff. The reason it won't help is that the design is _explicitly_ microcoded. E.g. RDRAND triggers running loadable microcode which is supposed to read the real RNG and AES it. Maybe there is an unrelated "bug" that allows that microcode to be corrupted after some particular instruction sequence happens. All yo…

It looks like the microcode is also encrypted. But perhaps that encryption could be reverse engineered from silicon? The Silicon Zoo tutorial noted that Pentium I-era chips were "easily viewable" [1], probably with optical microscopes. So perhaps some parts of some newer Intel processors can be done at home. So, the "plan of attack" (ha!):

* decap an Intel CPU and scan it

* decode the microcode encryption

* figure out how the hardware RNG works with the microcode (it's AES? ok.)

* and then analyzing the system of microcode and hardware for robustness and security.

Yeah, this is hand-wavey and probably incredibly implausible. But it seems like an interesting and challenging project or three.

[1] http://siliconzoo.org/tutorial.html

Re: How secure is Linux's random number generator?

#76

For those that aren't aware, the security of a rand number generator is very important: http://en.wikipedia.org/wiki/Random_number_generator_attack

A personal favourite: https://news.ycombinator.com/item?id=639976

That was a wonderful read. Thank you.

Re: How secure is Linux's random number generator?

#77
The best approach to have is IMHO here:

http://en.wikipedia.org/wiki//dev/random

Gutterman, Pinkas, & Reinman in March 2006 published a detailed cryptographic analysis of the Linux random number generator[5] in which they describe several weaknesses. Perhaps the most severe issue they report is with embedded or Live CD systems such as routers and diskless clients, for which the bootup state is predictable and the available supply of entropy from the environment may be limited. For a system with non-volatile memory, they recommend saving some state from the RNG at shutdown so that it can be included in the RNG state on the next reboot. In the case of a router for which network traffic represents the primary available source of entropy, they note that saving state across reboots "would require potential attackers to either eavesdrop on all network traffic" from when the router is first put into service, or obtain direct access to the router's internal state. This issue, they note, is particularly critical in the case of a wireless router whose network traffic can be captured from a distance, and which may be using the RNG to generate keys for data encryption.

It shouldn't be a religious but an engineering problem. If you manage keep some state between reboots and use it after the next reboot, you're making it hard enough for anybody not having the physical access to that state. Then you can also use RdRand to mix it with the output of your stream based on your state, and with other sources of entropy if you have them. If RdRand turns out to be suspicious, you're at least much better off than using only hard coded states.

Anybody knows if some kind of described state is used now?

Re: How secure is Linux's random number generator?

#78
post #12

Earlier quoted context omitted.

Ironically, it's particularly vis a vis cryptographic random number generation where we can most easily show open source cryptography failing its users; Debian fatally broke the OpenSSL CSPRNG so badly that attackers could remotely brute force SSH keys.

Whereas with closed source you would almost never know. Crypto is very hard to do properly, but at least with open source you have the possibility of independent third party analysis.

Wasn't the debian vulnerability discovered because someone noticed that two different servers had the same key? That would have gone down exactly the same with closed source.

Re: How secure is Linux's random number generator?

#79
post #13
post #5

Just because something is closed source doesn't mean it's insecure. RdRand meets various standards for RNGs and the dieharder tests don't show anything of concern. While you can't be 100 percent sure of the reliability of RdRand because you can't audit it, I feel safe trusting it for all but the most critical of applications. Here's a blog post describing testing RdRand with dieharder: http://smackerelofopinion.blogs…

But how can you be sure it's not just a very very good self-synchronising PRNG? f( , , ) =

Calculate how many bits intel could fit on a chip. Apply statistical tests until you're sure the output contains more than that much entropy?

Re: How secure is Linux's random number generator?

#80

Lame answer I know but: recompile kernel (or patch) out this crappy Intel HW support then ? And IIRC the Linux pseudo random generator was quite good. The only problem is exhausting the entropy pool.

I believe you can add 'nordrand' to your boot flags to turn off the kernel's usage of it.
Post reply on HN