May 24, 2006
This article was contributed by Jake Edge.
Eye catching headlines are seen every day on the web, but one needs to
be careful not to distort the contents of the article. A recent SecuriTeam
article
is headlined "Holes in the Linux Random Number Generator" but that title
overstates the actual contents of the
paper (PDF) it is announcing.
The three authors of the paper provide a nice detailed description of the
Linux random number generator (RNG) and the algorithms that it uses, while
also reporting a very theoretical attack. The basic attack is against the
"forward security" of the RNG via a single compromise of the contents of
the entropy pool. This value can be used to run the RNG algorithm in reverse
and recover previous states of the entropy pool. Doing this enough times
can recover keys that have been previously generated.
There are a number of reasons why this attack is considered to have little
impact on real world systems. The most obvious is that if an attacker can
access the state of the entropy pool, they have already broken the security
of the system and can, as root, do any number of different things to the
system. If recovering previously generated keys is the object of the attack,
the paper outlines ways to do that, but the processing requirements are
enormous as Ted Ts'o points out:
To put this in
perspective, generating a 1024 bit RSA key will require approximately
14 turns of the crank, so if you are lucky with the positioning of the
index *and* you penetrate the machine and capture the state of the
pool (which as I mentioned, probably means you've rooted the box and
the system will probably have to be reinstalled from trusted media
anyway), *and* a 1024-bit RSA key had just been generated, you would
be able to determine that 1024-bit RSA key with a work factor of
approximately O(2**68) if you are lucky (probability 1 in 8), and
O(2**96) if you are not.
The paper also describes a well known feature of the Linux RNG implementation
as if it were a newly discovered denial of service issue. The
/dev/random device
was specifically designed to block when the entropy pool had insufficient
entropy to satisfy the request. The /dev/urandom device is
provided as an alternative that generates very good random numbers and
does not block (and is therefore not
vulnerable to a denial of service).
For any but the most sensitive applications (key generation being an
obvious choice), /dev/urandom is the recommended source for random
numbers. Alan Cox sums up the situation nicely:
The denial of service when no true entropy exists is intentional and
long discussed. User consumption of entropy can be controlled by
conventional file permissions, acls and SELinux already, or by a policy
daemon or combinations thereof. It is clearly better to refuse to give
out entropy to people than to give false entropy.
The paper has sparked an interesting
discussion
on the linux kernel mailing list and has lead to some concrete suggestions
for improving the algorithm, but it would be an exaggeration to conclude that
the paper describes real world Linux security concerns. An administrator
or security professional reading the SecuriTeam headline might easily
be led astray.
(
Log in to post comments)