-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 =============================================================================== >> CERT-NL, 01-Mar-2000 << >> All CERT-NL information has been moved to http://cert.surfnet.nl. Links << >> to CERT-NL information contained in this advisory are therefore outdated. << >> << >> CERT-NL also has stopped the CERT-CC-Mirror service. Due to this the << >> links to the CERT-CC mirror are obsolete. Visit the CERT-CC site for the << >> complete CERT-CC advisory texts: http://www.cert.org << =============================================================================== =============================================================================== Security Advisory CERT-NL =============================================================================== Author/Source : Teun Nijssen Index : S-95-15 Distribution : World Page : 1 Classification: External Version: 1 Subject : /tmp sticky bit may allow root access Date : 15-aug-95 =============================================================================== CERT-NL received the following (signed) message from our Australian sister organisation. Their message is copied here verbatim: ============================================================================= AA-95.07 AUSCERT Advisory 15 August, 1995 Incorrect permissions on /tmp may allow root access - - ----------------------------------------------------------------------------- AUSCERT has received advice from the bugtraq mailing list that a vulnerability exists in Solaris systems that allows a race condition to be exploited to gain root access. The essential problem is that the sticky bit is sometimes not set on the /tmp directory, allowing users access to other user's files in /tmp. ** An exploit program for this vulnerability has been published. AUSCERT ** advises that the remedial action in Section 3 be performed immediately. 1. Description A race condition exists in at least one Solaris 2.x system program that can be exploited to gain root access if the user has access to the temporary files. Access to temporary files may be obtained if the permissions on the /tmp and /var/tmp directories are set incorrectly. The permissions on the /tmp directory are often reset incorrectly by the system if tmpfs (which is mounting swap as /tmp) is in use. This vulnerability has been confirmed with Sun Microsystems. This vulnerability affects Solaris 2.x (SunOS 5.x) systems. A similar problem has affected SunOS 4.1.x (Solaris 1.x) systems in the past, and these systems should also be checked for the correct permission bits. The remainder of this Advisory uses Solaris 2.x commands as examples. Similar commands and configurations exist for SunOS 4.1.x users. To determine if you are running tmpfs, the following command can be used to verify if the filesystem for /tmp is swap: % /usr/sbin/df /tmp Filesystem kbytes used avail capacity Mounted on swap 28348 12 28336 0% /tmp or look in the file /etc/vfstab for the configuration line: #device device mount FS fsck mount mount #to mount to fsck point type pass at boot options swap - /tmp tmpfs - yes - If either of these two conditions exist, then you are running tmpfs and the system may automatically reset the permission bits of /tmp at the next reboot. To verify if your configuration is vulnerable, the following command may be used: % ls -ld /tmp drwxrwxrwt 2 root 61 Aug 15 12:12 /tmp If the sticky bit (t) is not set (it will be an x), then the system is vulnerable. 2. Impact Users logged in to the system may gain unauthorised root privileges. ** Note: An exploit script for this vulnerability has been published. 3. Workarounds These workarounds have been verified with Sun Microsystems. Sun Microsystems expect a patch to be released in the near future. 3.1 Immediate Workaround The immediate workaround is to set the sticky bit on the /tmp directory using the following command as root: # /usr/bin/chmod 1777 /tmp Note that this command must be performed after each reboot if you are mounting swap as /tmp (using tmpfs). In addition, the ownership and group membership of the /tmp directory should be verified using ls -ld /tmp and if incorrect may be reset by: # /usr/bin/chown root /tmp # /usr/bin/chgrp root /tmp The AUSCERT Unix Security Checklist already addresses this issue in Section 5.5. The Unix Security Checklist may be obtained from: ftp://ftp.auscert.org.au/pub/auscert/papers/unix_security_checklist_1.0 3.2 System Reboot workaround It is possible to perform these commands automatically at reboot by creating the following script as /etc/init.d/tmpfsfix: - - -------------------------------------8<-------------------------------------- #!/bin/sh if [ -d /tmp ] then /usr/bin/chmod 1777 /tmp /usr/bin/chgrp root /tmp /usr/bin/chown root /tmp fi - - -------------------------------------8<-------------------------------------- A symbolic link should be then be created called /etc/rc3.d/S79tmpfix which points to /etc/init.d/tmpfsfix by issuing the following command as root: # /usr/bin/ln -s /etc/init.d/tmpfsfix /etc/rc3.d/S79tmpfix 3.3 /var/tmp permissions The /var/tmp directory should be similarly checked and corrected. Note that this directory is not usually mounted as tmpfs, and therefore is not subject to automatic resetting of its permission bits on reboot. % ls -ld /var/tmp drwxrwxrwt 2 root 512 Aug 15 11:35 /var/tmp - - ---------------------------------------------------------------------------- The AUSCERT team wishes to thank Mark Graff of Sun Microsystems, Marek Krawus of The University of Queensland, and Scott Chasin for their advice and cooperation in this matter. - - ---------------------------------------------------------------------------- CERT-NL thanks AUSCERT, will buy them a beer in Karlsruhe and advises its constituency to act as advised, pending the patch from SUN. ============================================================================== CERT-NL is the Computer Emergency Response Team for SURFnet customers. SURFnet is the Dutch network for educational, research and related institutes. CERT-NL is a member of the Forum of Incident Response and Security Teams (FIRST). All CERT-NL material is available under: http://cert.surfnet.nl/ In case of computer or network security problems please contact your local CERT/security-team or CERT-NL (if your institute is NOT a SURFnet customer please address the appropriate (local) CERT/security-team). CERT-NL is one/two hour(s) ahead of UTC (GMT) in winter/summer, i.e. UTC+0100 in winter and UTC+0200 in summer (DST). Email: cert-nl@surfnet.nl ATTENDED REGULARLY ALL DAYS Phone: +31 302 305 305 BUSINESS HOURS ONLY Fax: +31 302 305 329 BUSINESS HOURS ONLY Snailmail: SURFnet bv Attn. CERT-NL P.O. Box 19035 NL - 3501 DA UTRECHT The Netherlands NOODGEVALLEN: 06 22 92 35 64 ALTIJD BEREIKBAAR EMERGENCIES : +31 6 22 92 35 64 ATTENDED AT ALL TIMES CERT-NL'S EMERGENCY PHONENUMBER IS ONLY TO BE USED IN CASE OF EMERGENCIES: THE SURFNET HELPDESK OPERATING THE EMERGENCY NUMBER HAS A *FIXED* PROCEDURE FOR DEALING WITH YOUR ALERT AND WILL IN REGULAR CASES RELAY IT TO CERT-NL IN AN APPROPRIATE MANNER. CERT-NL WILL THEN CONTACT YOU. =============================================================================== -----BEGIN PGP SIGNATURE----- Version: PGP 6.5.1i iQA/AwUBOL6IFjSYjBqwfc9jEQKMpwCfUAhi6mdaEjagZMu7vzgltRqQH/gAoKup UGBV/0UKocMKJPIRre+6wGGM =5l3P -----END PGP SIGNATURE-----