4 ms·
Why is urandom meant to be more secure? I read this: "So I'm the maintainer for Linux's /dev/random driver. "... "The main thing which I am much more worried a
by luke-stanley 13y ago
Why is urandom meant to be more secure?
I read this:
"So I'm the maintainer for Linux's /dev/random driver. "...
"The main thing which I am much more worried about is that on various embedded systems, which do not have a fine-grained clock, and which is reading from flash which has a much more deterministic timing for their operations, is that when userspace tries to generate long-term public keys immediately after the machine is taken out of the box and plugged in, that there isn't a sufficient amount of entropy, and since most userspace applications use /dev/urandom since they don't want to block, that they end up with keys that aren't very random." - https://www.schneier.com/blog/archives/2013/10/insecurities_in.html#c1909001 https://www.schneier.com/blog/archives/2013/10/insecurities_...
Is that out of date?
Why so insistent?
Why not provide reasons that people can openly verify?
- tptacek 13y agourandom and /dev/random aren't two different CSPRNGs. They aren't really even two different designs. They are two different pools into which the same kinds of raw entropy are mixed; the interface to /dev/random's pool happens to have a weird gate on it that tries to determine how much "entropy" is "left" in the pool. I'm oversimplifying a little, but that's the gist of it. So the problem here is, if you're on a solid state embedded system that doesn't generate enough entropy to drive urandom, you're not doing enough to drive /dev/random either --- except, owing to a design flaw in Linux, on first-boot-ever, where /dev/random's entropy estimator gate saves from you from the bug that is Linux's willingness to give you output from an unseeded RNG. It shouldn't do that. FreeBSD doesn't. But if you're worried about that problem, the correct fix is to explicitly seed urandom from /dev/random on boot, not to use /dev/random in your code! Once the CSPRNG is seeded, the idea of a "sufficient amount of entropy" is silly. Think of a CSPRNG as a stream cipher. Think of its output as you would the keystream of that cipher. What does it mean, within reason (ie, not hundreds of terabytes) for a keystream to have "sufficient" key in it? Because that's essentially the same question the maintainer for /dev/random is asking.
- luke-stanley 13y agoHow do we know there isn't some predictable pattern from common urandom sources? What is meant to make the state non-predictable anyway? If I cared about it, someone could just add a library on top of it that combines them with more entropy sources. Like camera noise, temperature changes, audio static etc. For some reason the author says not to build libraries on top of urandom because they might be hacked. Well if something has compromised your system anyway, why does that matter?
- tptacek 13y ago"The urandom sources"? What do you think that means? The code is right there.
- luke-stanley 13y agoI'm talking about the sources of it's random input, not it's source code.
- tveita 13y agoYou can call it a bug or design flaw if you'd like, but this behaviour is documented, well known, and it's how every single Linux system operates. urandom simply isn't guaranteed to be random enough for cryptographic keys. Misusing it for this causes real-world problems. You are telling people to write insecure software. That it could be secure if Linux worked differently from how it actually works is completely irrelevant and bordering on denialism. If you want to fix Linux to be more like the other systems, great! Then /dev/random will be non-blocking and everyone can use that. Meanwhile, I'd much rather block than find myself sharing prime factors with random strangers.
- tptacek 13y agoOn the one hand you have Nacl, from Daniel J. Bernstein, Tanja Lange, and Peter Schwabe, the gold standard of misuse-resistant crypto libraries, relying entirely on urandom and documenting why. On the other, you have HN's 'tveita, saying that urandom "isn't guaranteed to be random enough for cryptographic keys". I could continue the argument, but since the whole post you're commenting on is that argument, I'd be repeating myself. So instead, I'll just ask: what specific assertion in that post do you disagree with?
- tveita 13y agoHow about the very post I replied to? > the bug that is Linux's willingness to give you output from an unseeded RNG So there you have it. But don't worry, no one uses this "Linux" thing, certainly not in embedded systems. https://factorable.net/ https://factorable.net/
- tptacek 13y agoKeep reading. I think you stopped too early.
- tveita 13y agoI read it all, don't be a jerk. When you're writing a program for generic use, you can't trust the underlying system to be set up above and beyond a stock install. If you want to use seeding as a workaround, it should be done from every program that requires secure randomness. That doesn't seem to be what you're advocating. And if you're just generating a key, why not read it directly from random instead? You can pretend that urandom gives good randomness and be surprised when you get key collisions. Just like you can pretend that strncpy null-terminates strings and be surprised when you get a buffer overflow vulnerability. That makes you a menace. For what's it's worth, I agree that an adequately seeded CSPRNG should never 'run out' of entropy, and I wouldn't mind if Linux got a BSD-style shared random/urandom. But as it stands, urandom is not guaranteed to be adequately seeded, and I have no idea why you would advocate taking that risk.