Florian Weimer reported a flaw in cumin that would cause it to create weak session keys. The wooly.util.unique_id() uses the random.getrandbits() function to generate the session keys, however random.getrandbits() leaks state and can eventually become predictable (according to the Python documentation it uses the Mersenne Twister algorithm). To create truly unique session keys, wooly.util.unique_id() should open /dev/urandom and read 16 bytes from there.
There is a fix for this in revision 5400 on the cumin trunk. Here is the diff: def unique_id(): - bits0 = random.getrandbits(32) - bits1 = random.getrandbits(32) - bits2 = random.getrandbits(32) - bits3 = random.getrandbits(32) - return "%08x-%08x-%08x-%08x" % (bits0, bits1, bits2, bits3) + # Generate 4 unsigned integers. + # Take 4 bytes from urandom and interpret + # them as a standard-sized ('=') unsigned long ('L'). + # Unpack returns a tuple, hence the [0]. + try: + bits = [struct.unpack("=L", os.urandom(4))[0] for x in range(4)] + except NotImplementedError: + bits = [random.getrandbits(32) for x in range(4)] + return "%08x-%08x-%08x-%08x" % (bits[0], bits[1], bits[2], bits[3]) +
svn diff -c 5400 http://svn.fedorahosted.org/svn/cumin svn diff -c 5437 http://svn.fedorahosted.org/svn/cumin
Acknowledgements: This issue was discovered by Florian Weimer of the Red Hat Product Security Team.
This issue has been addressed in following products: MRG for RHEL-5 v. 2 Via RHSA-2012:1278 https://rhn.redhat.com/errata/RHSA-2012-1278.html
This issue has been addressed in following products: MRG for RHEL-6 v.2 Via RHSA-2012:1281 https://rhn.redhat.com/errata/RHSA-2012-1281.html
Created cumin tracking bugs for this issue Affects: fedora-all [bug 858868]