Bug 758905 (CVE-2011-4944)

Summary: CVE-2011-4944 python: distutils creates ~/.pypirc insecurely
Product: [Other] Security Response Reporter: Vincent Danen <vdanen>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: derks, dmalcolm, ivazqueznet, jonathansteffan
Target Milestone: ---Keywords: Reopened, Security
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://bugs.python.org/issue13512
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-03 15:42:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 805382, 805383, 805384, 805385, 808303, 808304, 808305    
Bug Blocks: 790031    
Description Flags
proposed patch to correct the flaw none

Description Vincent Danen 2011-11-30 23:09:53 UTC
It was reported [1] that distutils would create ~/.pypirc insecurely.  There is a race from the time the user's username and password is written to the file to when it is chmod'd with appropriate permissions.

Typically, a user's home directory will be created with default 0700 permissions which would not allow for a local attacker to obtain access to this file during the race window, however if a user were to make their home directory 0755 they could be susceptible to this race.

One solution would be to use tempfile.mkstemp() to create the file and then move it in place.

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=650555

Comment 1 Vincent Danen 2011-11-30 23:11:05 UTC

The Red Hat Security Response Team has rated this issue as having low security impact. This issue is not currently planned to be addressed in future updates. For additional information, refer to the Issue Severity Classification: https://access.redhat.com/security/updates/classification/.

Comment 2 Vincent Danen 2011-11-30 23:12:42 UTC
Also, the pypi support seems to only be available in python 2.6 and higher, so earlier versions are unaffected.

Comment 3 Vincent Danen 2011-11-30 23:27:04 UTC
I've reported this upstream:


I don't believe this issue is significant enough (particularly due to the default of home directories being mode 0700) to warrant more than that.

Comment 4 Vincent Danen 2012-03-27 14:05:51 UTC
Upstream patch to go into 2.7.4:


Comment 7 Vincent Danen 2012-03-27 18:31:48 UTC
This does in fact affect RHEL5 and earlier; the vulnerable code is in Lib/distutils/command/register.py.

Comment 8 Vincent Danen 2012-03-27 18:40:58 UTC
Created attachment 573152 [details]
proposed patch to correct the flaw

This patch should correct the flaw in python 2.4.x.

Comment 10 Kurt Seifried 2012-03-27 18:47:58 UTC
Corrected CVE number as per http://www.openwall.com/lists/oss-security/2012/03/27/10

Comment 18 Huzaifa S. Sidhpurwala 2012-03-30 05:49:51 UTC
Created python tracking bugs for this issue

Affects: fedora-all [bug 808303]

Comment 19 Huzaifa S. Sidhpurwala 2012-03-30 05:49:57 UTC
Created python3 tracking bugs for this issue

Affects: fedora-all [bug 808304]

Comment 20 Huzaifa S. Sidhpurwala 2012-03-30 05:50:01 UTC
Created python26 tracking bugs for this issue

Affects: epel-5 [bug 808305]

Comment 21 errata-xmlrpc 2012-06-18 12:32:36 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 6

Via RHSA-2012:0744 https://rhn.redhat.com/errata/RHSA-2012-0744.html

Comment 22 errata-xmlrpc 2012-06-18 12:42:57 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5

Via RHSA-2012:0745 https://rhn.redhat.com/errata/RHSA-2012-0745.html