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.
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?
Statement: This flaw only affected GDM in Red Hat Enterprise Linux 5 and does not affect Red Hat Enterprise Linux 6.
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
Created attachment 794934 [details] patch for gdm This is the patch to remove the bits that created /tmp/.X11-unix.
Created attachment 794935 [details] patch for initscripts This is the patch to create /tmp/.X11-unix at boot.