home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / admin / 5053 < prev    next >
Encoding:
Internet Message Format  |  1992-09-15  |  1.8 KB

  1. Xref: sparky comp.unix.admin:5053 comp.unix.ultrix:6945 comp.unix.wizards:3919
  2. Path: sparky!uunet!gatech!concert!duke!trt
  3. From: trt@duke.cs.duke.edu (Tom Truscott)
  4. Newsgroups: comp.unix.admin,comp.unix.ultrix,comp.unix.wizards
  5. Subject: Re: random passwd generator
  6. Message-ID: <716612470@romeo.cs.duke.edu>
  7. Date: 16 Sep 92 03:01:11 GMT
  8. References: <1992Sep4.170148.17469@trentu.ca> <SY2PBNX5@cc.swarthmore.edu>
  9. Followup-To: comp.unix.admin
  10. Organization: IBM RTP
  11. Lines: 34
  12.  
  13. "Random" password generators rarely are.
  14. Never trust a password generator that using a pseudo-random
  15. number generator.
  16.  
  17. >    srandom((int)(time((time_t *)0)));
  18.  
  19. This (seconds-since-Epoch) is the only source of randomness in the program.
  20. Since srandom accepts a 32 bit number, the program can generate
  21. at most 4 billion different sequences of passwords.
  22. At 5k trial crypt()s/second an exhaustive attack using a single
  23. workstation would require 5 days on average to break a given sequence.
  24. A clever Bad Guy might first try times in the current month, of course :-)
  25.  
  26. Only by keeping the source (and binary) a secret can this weakness be hidden
  27. from the Bad Guy.  But you have just given the Bad Guys a copy.
  28.  
  29. You need much more randomness.  Create an array of "random_info":
  30.     time-since-Epoch -- seconds and microseconds.
  31.     current process id
  32.     parent process id
  33.     last access/modify times of directories and files such as
  34.         /
  35.         /tmp
  36.         /etc/passwd
  37.     (Even better, have the user type something and time the delay
  38.     between key presses with a high-accuracy clock or by busy-looping.
  39.     That defends against a Bad Guy logged onto your system at the time
  40.     you run the password generator.)
  41. Then use this info rather than calls to random().
  42. Or, if you must, at least periodically do
  43.     srandom(random() ^ random_info[i++ % info_count]);
  44. so that the random info gets folded into your calculations.
  45.  
  46. Tom Truscott
  47.