Bug 827558 (CVE-2012-2681) - CVE-2012-2681 cumin: weak session keys
Summary: CVE-2012-2681 cumin: weak session keys
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2012-2681
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 840106 858868
Blocks: 808230 828434 828935
TreeView+ depends on / blocked
 
Reported: 2012-06-01 18:32 UTC by Vincent Danen
Modified: 2023-05-12 20:17 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
: 840106 (view as bug list)
Environment:
Last Closed: 2021-10-19 21:54:02 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:1278 0 normal SHIPPED_LIVE Moderate: Red Hat Enterprise MRG Grid 2.2 security update 2012-09-19 21:40:26 UTC
Red Hat Product Errata RHSA-2012:1281 0 normal SHIPPED_LIVE Moderate: Red Hat Enterprise MRG Grid 2.2 security update 2012-09-19 21:51:29 UTC

Description Vincent Danen 2012-06-01 18:32:17 UTC
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 16:10:05 UTC
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 11:25:15 UTC
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 16:10:53 UTC
Acknowledgements:

This issue was discovered by Florian Weimer of the Red Hat Product Security Team.

Comment 6 errata-xmlrpc 2012-09-19 17:43:38 UTC
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 17:52:44 UTC
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 21:09:41 UTC
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.