Re: /dev/urandom uses uninit bytes, leaks user data

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Theodore Tso <tytso@...>, David Newall <david@...>, Andy Lutomirski <luto@...>, John Reiser <jreiser@...>, Matt Mackall <mpm@...>, <linux-kernel@...>, <security@...>
Date: Thursday, December 20, 2007 - 12:18 am

On Dec 17, 2007 10:46 PM, Theodore Tso <tytso@mit.edu> wrote:

I understand that there's no way that /dev/random can provide good
output if there's insufficient entropy.  But it still shouldn't leak
arbitrary bits of user data that were never meant to be put into the
pool at all.

(My hypothetical attack is a lot hypothetical than I thought at first.
 An attacker does not need to break into the kernel and steal the
state of the pool.  It may be as easy as this to trigger:

Step 1: Boot a system without a usable entropy source.
Step 2: add some (predictable) "entropy" from userspace which isn't a
multiple of 4, so up to three extra bytes get added.
Step 3: Read a few bytes of /dev/random and send them over the network.

An attacker can now try all possibilities of the three extra bytes and
guess them pretty quickly.  No compromise needed.  This is, IMHO, bad.
 (It's one thing for the "random" numbers to be weak.  It's another
thing entirely for them to reveal data that never belonged in the pool
in the first place.)

Actually, perhaps there should be a policy that we try never to reseed
the pool at all until there is enough entropy around to prevent
attacks like these.  (In theory the state of the pool might contain
2^(smallish number) bits of data interesting to the attacker even
without the uninitialized data issue.)  This would make the situation
even worse for low-entropy systems, though.

--Andy
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: /dev/urandom uses uninit bytes, leaks user data, Andrew Lutomirski, (Thu Dec 20, 12:18 am)
Re: /dev/urandom uses uninit bytes, leaks user data, Theodore Tso, (Thu Dec 20, 4:36 pm)
Re: /dev/urandom uses uninit bytes, leaks user data, Pavel Machek, (Thu Dec 27, 6:44 am)
Re: /dev/urandom uses uninit bytes, leaks user data, Phillip Susi, (Thu Dec 20, 4:17 pm)
Re: /dev/urandom uses uninit bytes, leaks user data, Andrew Lutomirski, (Fri Dec 21, 12:10 pm)
Re: /dev/urandom uses uninit bytes, leaks user data, Phillip Susi, (Wed Dec 26, 2:30 pm)
Re: /dev/urandom uses uninit bytes, leaks user data, Theodore Tso, (Fri Dec 21, 9:14 pm)