home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / general / cert0096.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  13.6 KB  |  319 lines

  1.  
  2. -----BEGIN PGP SIGNED MESSAGE-----
  3.  
  4. =============================================================================
  5. CERT(sm) Advisory CA-95:09                 
  6. Original issue date: August 29, 1995
  7. Last revised: August 30, 1996
  8.               Information previously in the README was inserted
  9.               into the advisory. Updated version number of AUSCERT checklist
  10.               and the appendix.
  11.  
  12.               A complete revision history is at the end of this file.
  13.                     
  14. Topic: Solaris ps Vulnerability
  15. - -----------------------------------------------------------------------------
  16.  
  17.                The text of this advisory is taken primarily 
  18.            from AUSCERT advisory AA-95.07, with their permission.  
  19.  
  20. A vulnerability exists in Solaris systems that allows a race condition to be
  21. exploited to gain root access.  The essential problem is that the ps(1)
  22. program maintains a data file in the /tmp directory, and the /tmp directory is
  23. world-writable, allowing users to delete other users' files in /tmp. This
  24. vulnerability affects Solaris 2.x (SunOS 5.x) systems. 
  25.  
  26. An exploit program for this vulnerability has been published. We urge
  27. you to take the actions described in Section III as soon as possible.
  28.  
  29. We will update this advisory as we receive additional information.
  30. Please check advisory files regularly for updates that relate to your site.
  31.  
  32. - ------------------------------------------------------------------------------
  33. I.   Description
  34.  
  35.      A race condition exists in at least one Solaris 2.x (SunOS 5.x) system
  36.      program that can be exploited to gain root access if the user has access
  37.      to the temporary files.  Access to temporary files may be obtained if the
  38.      permissions on the /tmp and /var/tmp directories are set incorrectly. 
  39.      The permissions on the /tmp directory are often reset incorrectly by
  40.      the system if tmpfs (which is mounting swap as /tmp) is in use.
  41.  
  42. II.  Impact
  43.  
  44.      Users logged in to the system may gain unauthorized root privileges.
  45.      
  46. III. Solution
  47.      
  48.      A. Determine if your system is vulnerable
  49.  
  50.         To determine if you are running tmpfs, the following command can be
  51.         used to verify if the file system for /tmp is swap:
  52.  
  53.           % /usr/sbin/df -k /tmp
  54.           Filesystem          kbytes    used   avail capacity  Mounted on
  55.           swap                 28348     12    28336     0%    /tmp
  56.  
  57.         or look in the file /etc/vfstab for the configuration line:
  58.  
  59.           #device     device   mount    FS      fsck    mount     mount
  60.           #to mount   to fsck  point    type    pass    at boot   options
  61.           swap          -      /tmp     tmpfs     -      yes         -
  62.  
  63.         If either of these two conditions exist, then you are running tmpfs
  64.         and the system may automatically reset the permission bits of /tmp at
  65.         the next reboot.
  66.  
  67.          To verify if your configuration is currently vulnerable, the
  68.          following command may be used:
  69.  
  70.               % /usr/bin/ls -ld /tmp
  71.               drwxrwxrwt   2 root     root       61 Aug 15 12:12 /tmp
  72.  
  73.          If the sticky bit (t) is not set (it will be an x), then the
  74.          system is vulnerable.  In addition, we recommend that the owner
  75.          and group for /tmp be changed to root and root, respectively.
  76.  
  77.  
  78.      B. Perform the following workarounds
  79.  
  80.         These workarounds have been verified with Sun Microsystems. Apply
  81.         these workarounds until you an install a patch. (Patch information is
  82.         in Sec. C. below.)
  83.  
  84.         1. Immediate - fix /tmp permissions
  85.  
  86.            A workaround that takes effect immediately is to set the sticky bit
  87.            on the /tmp directory using the following command as root:
  88.  
  89.              # /usr/bin/chmod 1777 /tmp
  90.  
  91.            Note that this command must be performed after each reboot if you
  92.            are mounting swap as /tmp (using tmpfs).
  93.  
  94.           In addition, the ownership and group membership of the /tmp
  95.           directory should be verified using /usr/bin/ls -ld /tmp, and if
  96.           incorrect may be reset by:
  97.  
  98.              # /usr/bin/chown root /tmp
  99.              # /usr/bin/chgrp root /tmp
  100.  
  101.            The AUSCERT UNIX Security Checklist addresses this issue in
  102.            Section 5.5.  This section is reproduced in the appendix of this
  103.            advisory. The entire AUSCERT checklist may be obtained from these
  104.            locations.
  105.           
  106.            Sites outside of Australia should use the info.cert.org FTP site.
  107.  
  108.        ftp://info.cert.org/pub/tech_tips/AUSCERT_checklist_1.1
  109.        ftp://ftp.auscert.org.au/pub/auscert/papers/unix_security_checklist_1.1
  110.  
  111.         2. Permanent - make the above change to /tmp permissions permanent
  112.  
  113.                 The change noted in item B.1 above will be lost upon
  114.                 reboot. To make the changes permanent, create the
  115.                 following script as /etc/init.d/tmpfsfix:
  116.  
  117.           -----------------------------cut here--8<----------------------------
  118.           #!/bin/sh
  119.  
  120.           if [ -d /tmp ]
  121.           then
  122.              /usr/bin/chmod 1777 /tmp
  123.              /usr/bin/chgrp root /tmp
  124.              /usr/bin/chown root /tmp
  125.           fi
  126.           ------------------------------cut here---8<--------------------------
  127.  
  128.           After creating this file, the following commands should be issued
  129.           as root to make the file executable, set appropriate owner and group,
  130.           and create the necessary symbolic link to ensure that it is executed
  131.           upon reboot appropriately:
  132.  
  133.              # /usr/bin/ln -s /etc/init.d/tmpfsfix /etc/rc2.d/S06tmpfix
  134.              # /usr/bin/chmod 744  /etc/init.d/tmpfsfix
  135.              # /usr/bin/chown root /etc/init.d/tmpfsfix
  136.              # /usr/bin/chgrp sys /etc/init.d/tmpfsfix
  137.              # /bin/rm -f /etc/rc3.d/S79tmpfix
  138.  
  139.           If you have done item B.1 above, you can reboot at your leisure.
  140.           Otherwise, reboot your system now. In either case, verify the
  141.           permissions of /tmp immediately after your next system reboot.
  142.  
  143.        3. Check /var/tmp permissions
  144.  
  145.           We recommend that you also check and correct the /var/tmp
  146.           directory.  Note that this directory is not usually mounted as
  147.           tmpfs, so it normally would not be subject to automatic resetting
  148.           of its permission bits on reboot.
  149.  
  150.            % /usr/bin/ls -ld /var/tmp
  151.              drwxrwxrwt   2 root     root      512 Aug 15 11:35 /var/tmp
  152.  
  153.     C. Install a vendor patch
  154.  
  155.        On September 20, 1995, Sun Microsystems, Inc., provided the following
  156.        information in their advisory.
  157.  
  158. - ---------------------------------------------------------------------------
  159.             Begin Text provided by vendor
  160.  
  161. II. Announcement of patches for Solaris 2.x "ps_data" vulnerability
  162.  
  163.     A. Patch list
  164.  
  165.     We have produced patches for the versions of SunOS shown below.
  166.  
  167.          OS version      Patch ID    Patch File Name
  168.          ----------      ---------   --------------- 
  169.          5.3             101545-02   101545-02.tar.Z
  170.          5.4             102711-01   102711-01.tar.Z
  171.          5.4_x86         102712-01   102712-01.tar.Z
  172.  
  173.     B. Patch notes
  174.  
  175.     1. SunOS 4.1.x systems are not affected by this bug.
  176.  
  177.     2. The fix has been applied to the upcoming version of Solaris.
  178.  
  179.  
  180. III. Checksum Table
  181.  
  182.     In the checksum table we show the BSD and SVR4 checksums and MD5
  183.     digital signatures for the compressed tar archives.
  184.  
  185.    File            BSD          SVR4        MD5
  186.    Name            Checksum     Checksum    Digital Signature
  187.    --------------- -----------  ----------  --------------------------------
  188.    101545-02.tar.Z 41218    77  47754  153  A8FB866780E7207D26CF16210BCFDC83
  189.    102711-01.tar.Z 17256    69  20376  138  98A449372C5ABBDB7C37B08BFE0E6ED7
  190.    102712-01.tar.Z 29867    68  56717  136  E324004BB8C09990B2790CB5D29D3AF5
  191.  
  192.    The checksums shown above are from the BSD-based checksum
  193.    (on 4.1.x, /bin/sum;  on Solaris 2.x, /usr/ucb/sum) and from
  194.    the SVR4 version on Solaris 2.x (/usr/bin/sum).
  195.  
  196.             End Text provided by vendor
  197. - ---------------------------------------------------------------------------
  198.  
  199. ..............................................................................
  200. Appendix: Excerpt from AUSCERT UNIX Security Checklist (Version 1.1)
  201.  5.5  File Permissions 
  202.    *    ENSURE that the permissions of /etc/utmp are set to 644.
  203.    *    ENSURE that the permissions of /etc/sm and /etc/sm.bak are set to
  204.         2755.
  205.    *    ENSURE that the permissions of /etc/state are set to 644.
  206.    *    ENSURE that the permissions of /etc/motd and /etc/mtab are set to 644.
  207.    *    ENSURE that the permissions of /etc/syslog.pid are set to 644.
  208.             [NOTE: this may be reset each time you restart syslog.]
  209.    *    DO consider removing read access to files that users do not need to 
  210.         access.
  211.    *    ENSURE that the kernel (e.g., /vmunix) is owned by root, has group set
  212.  
  213.         to 0 (wheel on SunOS) and permissions set to 644.
  214.    *    ENSURE that /etc, /usr/etc, /bin, /usr/bin, /sbin, /usr/sbin, /tmp and
  215.          /var/tmp are owned by root and that the sticky-bit is set on /tmp and
  216.         on /var/tmp (see G.14).  Refer to the AUSCERT Advisory AA-95:05 (see 
  217.          A.1).
  218.    *    ENSURE that there are no unexpected world writable files or 
  219.         directories on your system.  
  220.         See G.15 for example commands to find group and world writable files
  221.         and directories.                           
  222.    *    CHECK that files which have the SUID or SGID bit enabled, should have
  223.         it enabled (see G.16).
  224.    *    ENSURE the umask value for each user is set to something sensible 
  225.         like 027 or 077. 
  226.         (Refer to section E.1 for a shell script to check this).
  227.    *    ENSURE all files in /dev are special files.
  228.             Special files are identified with a letter in the first position
  229.             of the permissions bits.  See G.17 for a command to find files in 
  230.             /dev which are not special files or directories.
  231.             Note: Some systems have directories and a shell script in /dev
  232.             which may be legitimate.  Please check the manual pages for more 
  233.             information.
  234.    *    ENSURE that there are no unexpected special files outside /dev.
  235.         See G.18 for a command to find any block special or character
  236.         special files.
  237.  
  238. - ----------------------------------------------------------------------------
  239. The CERT Coordination Center staff thanks AUSCERT, the Australian response
  240. team, for their permission to reuse text from their advisory AA-95.07 and 
  241. for their cooperation and assistance.
  242. - ----------------------------------------------------------------------------
  243.  
  244. If you believe that your system has been compromised, contact the CERT
  245. Coordination Center or your representative in the Forum of Incident
  246. Response and Security Teams (FIRST).
  247.  
  248. If you wish to send sensitive incident or vulnerability information to
  249. CERT staff by electronic mail, we strongly advise that the email be
  250. encrypted.  The CERT Coordination Center can support a shared DES key, PGP
  251. (public key available via anonymous FTP on info.cert.org), or PEM (contact
  252. CERT staff for details).
  253.  
  254. Internet email: cert@cert.org
  255. Telephone: +1 412-268-7090 (24-hour hotline)
  256.            CERT personnel answer 8:30 a.m.-5:00 p.m. EST(GMT-5)/EDT(GMT-4),
  257.            and are on call for emergencies during other hours.
  258. Fax: +1 412-268-6989
  259.  
  260. Postal address:  CERT Coordination Center
  261.                  Software Engineering Institute
  262.                  Carnegie Mellon University
  263.                  Pittsburgh, PA 15213-3890
  264.                  USA
  265.  
  266. CERT advisories and bulletins are posted on the USENET newsgroup
  267. comp.security.announce. If you would like to have future advisories and
  268. bulletins mailed to you or to a mail exploder at your site, please send mail
  269. to cert-advisory-request@cert.org.
  270.  
  271. Past CERT publications, information about FIRST representatives, and
  272. other information related to computer security are available for anonymous
  273. FTP from info.cert.org. 
  274.  
  275. This material may be reproduced and distributed without permission provided it
  276. is used for noncommercial purposes, and the CERT Coordination Center and
  277. AUSCERT are acknowledged.
  278.  
  279. CERT is a service mark of Carnegie Mellon University.
  280.  
  281. =============================================================================
  282. UPDATES
  283.  
  284. If anyone has trouble retrieving the electronic file CA-95:09.Solaris.ps.vul,
  285. they should use the file name CA-95:09.Solaris-ps.vul.
  286.  
  287.  
  288. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  289. Revision history
  290.  
  291. Aug. 30, 1996  Information previously in the README was inserted
  292.                 into the advisory. Updated version number of AUSCERT checklist
  293.                 and the appendix.
  294. Sep. 20, 1995  Sec. III.A.1 - corrected the command and explanation for
  295.                 checking your configuration.
  296.                Sec. III.B.1 - corrected commands for verifying ownership and
  297.                 group membership.
  298.                Sec. III.B.2 - replaced this section, which was incorrect.
  299.                Sec. III.B.3 - replaced the text and command.
  300.                Sec. III.C - added this section, which contains Sun patch
  301.                 information.
  302.                Appendix - corrected item 10.
  303.                Updates section - added a note about the file name.
  304.  
  305.  
  306.  
  307.  
  308.  
  309. -----BEGIN PGP SIGNATURE-----
  310. Version: 2.6.2
  311.  
  312. iQCVAwUBMiS5XXVP+x0t4w7BAQGZjQP+JrrejhcSiirhSD/v8jimMcKTlI5OJwx7
  313. 2gIhsUeJ/mUP5nbWLySxMh9HTu3VaBacl79eS07ospL671fJmuysU87WdlLhLjwt
  314. PvkbY2KBwOsV9KoaotHcV5Hlw6ZfQyKVhDJrtIlILLmR6UNwYRhPeWqZEmnchWps
  315. Bclz1zVmZeo=
  316. =OyXc
  317. -----END PGP SIGNATURE-----
  318.  
  319.