Bug 827558 - (CVE-2012-2681) CVE-2012-2681 cumin: weak session keys
CVE-2012-2681 cumin: weak session keys
Status: NEW
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
: Security
Depends On: 840106 858868
Blocks: 808230 828434 828935
  Show dependency treegraph
Reported: 2012-06-01 14:32 EDT by Vincent Danen
Modified: 2013-07-05 11:26 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 840106 (view as bug list)
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Vincent Danen 2012-06-01 14:32:17 EDT
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.
Comment 1 Trevor McKay 2012-06-04 12:10:05 EDT
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])
Comment 2 Tomas Hoger 2012-08-07 07:25:15 EDT
svn diff -c 5400 http://svn.fedorahosted.org/svn/cumin
svn diff -c 5437 http://svn.fedorahosted.org/svn/cumin
Comment 5 Vincent Danen 2012-09-19 12:10:53 EDT

This issue was discovered by Florian Weimer of the Red Hat Product Security Team.
Comment 6 errata-xmlrpc 2012-09-19 13:43:38 EDT
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
Comment 7 errata-xmlrpc 2012-09-19 13:52:44 EDT
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
Comment 8 Vincent Danen 2012-09-19 17:09:41 EDT
Created cumin tracking bugs for this issue

Affects: fedora-all [bug 858868]

Note You need to log in before you can comment on or make changes to this bug.