21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Discussion<br />

Stream ciphers are actually cryptographic pseudo-random number generators. One<br />

major practical differentiator between the two terms is whether you are using the<br />

output of the generator to perform encryption. If you are, it is a stream cipher; otherwise,<br />

it is a cryptographic pseudo-random number generator.<br />

Another difference is that, when you are using a stream cipher to encrypt data, you<br />

need to be able to reproduce the same stream of output to decrypt the encrypted<br />

data. With a cryptographic PRNG, there is generally no need to be able to reproduce<br />

a data stream. Therefore, the generator can be reseeded at any time to help protect<br />

against internal state guessing attacks, which is analogous to rekeying a stream<br />

cipher.<br />

The primary concern with a good cryptographic PRNG at the application level is<br />

internal state compromise, which would allow an attacker to predict its output. As<br />

long as the cryptographic algorithms used by a PRNG are not broken and the generator<br />

is not used to produce more output than it is designed to support, state compromise<br />

is generally not feasible by simply looking at the generator’s output. The<br />

number of outputs supported by a generator varies based on the best attacks possible<br />

for whatever cryptographic algorithms are in use.<br />

The risk of state compromise is generally not a big deal when dealing with something<br />

like /dev/random, where the generator is in the kernel. The only way to compromise<br />

the state is to be inside the kernel. If that’s possible, there are much bigger<br />

problems than /dev/urandom or CryptGenRandom( ) producing data that an attacker<br />

can guess.<br />

In the user space, state compromise may be more of an issue, though. You need to<br />

work through the threats about which you are worried. Threats are likely to come<br />

only from code on the local machine, but what code? Are you worried about malicious<br />

applications running with the same permissions being able to somehow peer<br />

inside the current process to get the internal state? If so, perhaps you should have a<br />

separate process that only provides entropy and runs with a set of permissions where<br />

only itself and the superuser would be a concern (this is the recommended approach<br />

for using the EGADS package discussed in Recipe 11.8).<br />

If state compromise is a potential issue, you might have to worry about more than an<br />

attacker guessing future outputs. You might also have to worry about an attacker<br />

backtracking, which means compromising previous outputs the generator made.<br />

Reseeding the generator periodically, as discussed in Recipe 11.6, can solve this<br />

problem. At best, an attacker should only be able to backtrack to the last reseeding<br />

(you can reseed without new entropy to mix in).<br />

In practice, few people should have to worry very much about state compromise of<br />

their cryptographic PRNG. As was the case at the operating system level, if such<br />

582 | Chapter 11: Random Numbers<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!