Bug 988498 (CVE-2013-4169)

Summary: CVE-2013-4169 gdm: TOCTTOU race condition on /tmp/.X11-unix
Product: [Other] Security Response Reporter: Vincent Danen <vdanen>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: ajax, jkurik, jrusnack, lnykryn, notting, rstrode, security-response-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: gdm 2.21.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-05 21:52:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 997619, 997620, 997622, 997624    
Bug Blocks: 988499    
Attachments:
Description Flags
patch for gdm
none
patch for initscripts none

Description Vincent Danen 2013-07-25 17:37:47 UTC
Vladz reported that GDM versions < 2.21.1 were vulnerable to a TOCTTOU (time of check to time of use) flaw in the way that GDM checked for the existence of, and created if missing, the /tmp/.X11-unix/ special directory.  A local attacker could use this flaw to overwrite arbitrary file contents via symbolic link attacks or to manipulate the contents of arbitrary files, including those files owned by the root user that would normally be inaccessible.  This is because GDM will chown /tmp/.X11-unix to the user and group root, but also changes the permissions to 1777.

Newer versions of GDM no longer create the /tmp/.X11-unix/ directory and are thus not vulnerable to this flaw.


Acknowledgements:

Red Hat would like to thank the researcher with the nickname vladz for reporting this issue.

Comment 1 Vincent Danen 2013-07-25 17:45:34 UTC
One possible solution is to prevent GDM from ever creating this directory by pre-creating it in /etc/rc.sysinit (like we do for /tmp/.ICE-unix).  That or simply don't remove it when we boot; in /etc/rc.sysinit we remove /tmp/.X*unix on line 882; we also remove /tmp/.ICE-unix but recreate it correctly later on (line 887).  That would involve patching initscripts rather than gdm though.

Thoughts?

Comment 16 Vincent Danen 2013-09-05 18:47:11 UTC
Statement:

This flaw only affected GDM in Red Hat Enterprise Linux 5 and does not affect Red Hat Enterprise Linux 6.

Comment 17 errata-xmlrpc 2013-09-05 18:56:02 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5

Via RHSA-2013:1213 https://rhn.redhat.com/errata/RHSA-2013-1213.html

Comment 18 Vincent Danen 2013-09-06 18:38:58 UTC
Created attachment 794934 [details]
patch for gdm

This is the patch to remove the bits that created /tmp/.X11-unix.

Comment 19 Vincent Danen 2013-09-06 18:39:55 UTC
Created attachment 794935 [details]
patch for initscripts

This is the patch to create /tmp/.X11-unix at boot.