This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 758905 - (CVE-2011-4944) CVE-2011-4944 python: distutils creates ~/.pypirc insecurely
CVE-2011-4944 python: distutils creates ~/.pypirc insecurely
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
low Severity low
: ---
: ---
Assigned To: Red Hat Product Security
http://bugs.python.org/issue13512
impact=low,public=20111130,reported=2...
: Reopened, Security
Depends On: 805382 805383 805384 805385 808303 808304 808305
Blocks: 790031
  Show dependency treegraph
 
Reported: 2011-11-30 18:09 EST by Vincent Danen
Modified: 2015-11-24 09:51 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-07-03 11:42:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
proposed patch to correct the flaw (864 bytes, patch)
2012-03-27 14:40 EDT, Vincent Danen
no flags Details | Diff

  None (edit)
Description Vincent Danen 2011-11-30 18:09:53 EST
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 18:11:05 EST
Statement:

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 18:12:42 EST
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 18:27:04 EST
I've reported this upstream:

http://bugs.python.org/issue13512

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 10:05:51 EDT
Upstream patch to go into 2.7.4:

http://bugs.python.org/file23824/pypirc-secure.diff
Comment 7 Vincent Danen 2012-03-27 14:31:48 EDT
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 14:40:58 EDT
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 14:47:58 EDT
Corrected CVE number as per http://www.openwall.com/lists/oss-security/2012/03/27/10
Comment 18 Huzaifa S. Sidhpurwala 2012-03-30 01:49:51 EDT
Created python tracking bugs for this issue

Affects: fedora-all [bug 808303]
Comment 19 Huzaifa S. Sidhpurwala 2012-03-30 01:49:57 EDT
Created python3 tracking bugs for this issue

Affects: fedora-all [bug 808304]
Comment 20 Huzaifa S. Sidhpurwala 2012-03-30 01:50:01 EDT
Created python26 tracking bugs for this issue

Affects: epel-5 [bug 808305]
Comment 21 errata-xmlrpc 2012-06-18 08:32:36 EDT
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 08:42:57 EDT
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

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