lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5ece0d580604011812g41c0b8a1n646b8629b45308c4@mail.gmail.com>
Date: Sat, 1 Apr 2006 18:12:15 -0800
From: coderpunk <coderpunk@...il.com>
To: bugtraq@...urityfocus.com
Subject: Flaw in commonly used bash random seed method


I think I just discovered a flaw in what appears to be a common way to
see bash's $RANDOM function. bash provides a pseudo-random number,
from 0-32767, using the $RANDOM function. You can seed this by setting
RANDOM=42 or some other number. Otherwise it is seeded by the process
id and time.

There are a plethora of usenet and web posts that suggest using the
following to seed the function:
SEED=$(head -1 /dev/urandom | od -N 1 | awk '{ print $2 }')

But look at the output, and the manpage for od. All this is doing is
reading 1 line of /dev/urandom (a binary stream), passing it to od
which is taking 1 byte and converting it to octal and printing it with
awk. What's wrong with this picture? You've just taken a random source
and turned it into a number from 0-255!

I hope you haven't been generating your password lists with any of the
scripts using that seed method.

Here is a better way:

SEED=$(head -c4 /dev/urandom | od -t u4 | awk '{ print $2 }')

This reads 4 bytes from /dev/urandom, passed it to od which converts
it into a unsigned 4 byte integer and prints it. This should have a
range of 2**32 (4294967296L) which is a bit more secure than 0-255.

.cp


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ