18.12.2012 Views

O'Reilly - Practical UNIX & Internet Sec... 7015KB

O'Reilly - Practical UNIX & Internet Sec... 7015KB

O'Reilly - Practical UNIX & Internet Sec... 7015KB

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

[Chapter 23] 23.8 Picking a Random Seed<br />

3.<br />

This practice was the problem with the Netscape security bug. The problem was that even though<br />

the <strong>UNIX</strong> operating system API appears to return the current time to the nearest microsecond,<br />

most operating systems have a resolution considerably coarser-usually within one 1/60th of a<br />

second or less. As Kaufman et al point out, if a clock has only 1/60th of a second granularity, and<br />

the intruder knows to the nearest hour at what time the current time was sampled, then there are<br />

only 60x60x60 = 216,000 possible values for the supposedly random seed.<br />

Divulging the seed value itself.<br />

In one case reported by Kaufman et al, and originally discovered by Jeff Schiller of MIT, a<br />

program used the time of day to choose a per-message encryption key. The problem in this case<br />

was that the application included the time that the message was generated in its unencrypted<br />

header of the message.<br />

How do you pick a good random number? Here are some ideas:<br />

1.<br />

2.<br />

3.<br />

4.<br />

Use a genuine source of randomness, such as a radioactive source, static on the FM dial, thermal<br />

noise, or something similar.<br />

Measuring the timing of hard disk drives can be another source of randomness, provided that you<br />

can access the hardware at a sufficiently low level.<br />

Ask the user to type a set of text, and sample the time between keystrokes.<br />

If you get the same amount of time between two keystrokes, throw out the second value; the user<br />

is prob- ably holding down a key and the key is repeating. (This technique is used by PGP as a<br />

source of randomness for its random number generator.)<br />

Monitor the user.<br />

Each time the user presses the keyboard, take the time between the current keypress and the last<br />

keypress, add it to the current random number seed, and hash the result with a cryptographic hash<br />

function. You can also use mouse movements to add still more randomness.<br />

Monitor the computer.<br />

Use readily available, constantly changing information, such as the number of virtual memory<br />

pages that have been paged in, the status of the network, and so forth.<br />

In December 1994, Donald Eastlake, Steve Crocker, and Jeffrey Schiller prepared RFC 1750, which<br />

made many observations about picking seeds for random number generators. Among them:<br />

1.<br />

2.<br />

Avoid relying on the system clock.<br />

Many system clocks are surprisingly non-random. Many clocks which claim to provide accuracy<br />

actually don't, or they don't provide good accuracy all the time.<br />

Don't use Ethernet addresses or hardware serial numbers.<br />

Such numbers are usually "heavily structured" and have "heavily structured subfields." As a result,<br />

one could easily try all of the possible combinations, or guess the value based on the date of<br />

manufacture.<br />

file:///C|/Oreilly Unix etc/<strong>O'Reilly</strong> Reference Library/networking/puis/ch23_08.htm (2 of 3) [2002-04-12 10:44:54]

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

Saved successfully!

Ooh no, something went wrong!