Re:Android RNG Weakness Renders Bitcoin Wallets Insecure
by tptacek on Sunday August 11, 2013 @11:44PM
(#6197548)
Linux random/urandom is supposed to prevent short-reads for exactly this reason. You raise an interesting point, but I'm not persuaded that the risk of quietly failing to read from the random device is greater than the risks of adopting an entire new CSPRNG to sit on top of the OS's CSPRNG.
Re:Android RNG Weakness Renders Bitcoin Wallets Insecure
by cperciva on Monday August 12, 2013 @01:06AM
(#6197741)
Linux random/urandom is supposed to prevent short-reads for exactly this reason.
Oh great, yet another way that Linux developers are going to write broken code because they think the whole unix world behaves like Linux...
Re:Android RNG Weakness Renders Bitcoin Wallets Insecure
by tptacek on Monday August 12, 2013 @10:54AM
(#6199518)
So then what you should do is write a "libpcap for randomness" that uses the best-practices method of getting randomness from the OS CSPRNG. On Linux it'll be just a couple lines; on BSD it'll be a few more lines for the "atomicio" equivalent read, and on WINAPI it'd set up and call CryptGenRandom.
There's value in having a uniform interface to all the different OS CSPRNGs.
What I'm saying isn't valuable is duplicative effort to build additional CSPRNG logic in the app layer. As we keep seeing, these app-layer CSPRNGs are additional single points of failure; they don't add defensive depth.
Re:Android RNG Weakness Renders Bitcoin Wallets Insecure
by tedunangst on Monday August 12, 2013 @12:22PM
(#6200018)
How is OpenSSL RAND_bytes not that uniform interface?
Re:Android RNG Weakness Renders Bitcoin Wallets Insecure
by tptacek on Monday August 12, 2013 @12:35PM
(#6200110)
OpenSSL provides its own CSPRNG. When that CSPRNG breaks, as it has in the past, no amount of careful validation of the OS CSPRNG helps you. The OpenSSL CSPRNG is thus a second single point of failure.
Ok, we disagree. It wouldn't be the first time. ;-)
the Debian OpenSSL bug was an entirely unforced error stemming from applications that chose to use Debian OpenSSL's terrible CSPRNG on top of the OS's CSPRNG
I think the biggest problem was that OpenSSL used OpenSSL's CSPRNG after Debian broke it. Having applications all open+read+close /dev/random is not going to prevent that.
a far more likely concrete flaw is, for instance, a SecureRandom implementation that allows developers to specify insecure seed values.
A SecureRandom implementation should not allow the application to provide seed values except as additional input. It should always seed itself from the operating system entropy source, with no option to disable that.
Aside from the issue of performance (which can be severe) and the timing information leakage to local spies, there's a very practical reason to avoid developers read from /dev/random:
I've seen this on a number of occasions, and it works perfectly fine... until your server gets busy, the kernel entropy pool runs down, and /dev/random returns a short read. At that point, all hell breaks loose. To me, this scenario alone is enough to tell developers to use a library's automatically seeded CSPRNG instead of reading from the kernel.