home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / texts / hacking_info_a-l / cert829.doc < prev    next >
Internet Message Format  |  2001-02-10  |  11KB

  1. From cert-advisory-request@cert.org Tue Aug 29 15:47:43 1995
  2. Return-Path: cert-advisory-request@cert.org
  3. Received: from why.cert.org (why.cert.org [192.88.209.31]) by server.snni.com (8.6.11/8.6.9) with ESMTP id PAA06285 for <noid@server.snni.com>; Tue, 29 Aug 1995 15:47:40 -0700
  4. Received: (from cert-advisory@localhost) by why.cert.org (8.6.12/CERT-ecd.1) id SAA14003 for cert-advisory-queue-22; Tue, 29 Aug 1995 18:21:52 -0400
  5. Date: Tue, 29 Aug 1995 18:21:52 -0400
  6. Message-Id: <199508292221.SAA14003@why.cert.org>
  7. From: CERT Advisory <cert-advisory@cert.org>
  8. To: cert-advisory@cert.org
  9. Subject: CERT Advisory CA-95:09 - Solaris ps Vulnerability
  10. Reply-To: cert-advisory-request@cert.org
  11. Organization: CERT Coordination Center - 412-268-7090
  12. Status: RO
  13. X-Status: 
  14.  
  15. =============================================================================
  16. CA-95:09                       CERT Advisory
  17.                               August 29, 1995
  18.                           Solaris ps Vulnerability
  19. -----------------------------------------------------------------------------
  20.  
  21.                The text of this advisory is taken primarily 
  22.            from AUSCERT advisory AA-95.07, with their permission.  
  23.  
  24. A vulnerability exists in Solaris systems that allows a race condition to be
  25. exploited to gain root access.  The essential problem is that the ps(1)
  26. program maintains a data file in the /tmp directory, and the /tmp directory is
  27. world-writable, allowing users to delete other users' files in /tmp. This
  28. vulnerability affects Solaris 2.x (SunOS 5.x) systems. 
  29.  
  30. An exploit program for this vulnerability has been published. We urge
  31. you to take the actions described in Section III as soon as possible.
  32.  
  33. As we receive additional information relating to this advisory, we
  34. will place it in
  35.  
  36.         ftp://info.cert.org/pub/cert_advisories/CA-95:09.README
  37.  
  38. We encourage you to check our README files regularly for updates on
  39. advisories that relate to your site.
  40.  
  41. ------------------------------------------------------------------------------
  42. I.   Description
  43.  
  44.      A race condition exists in at least one Solaris 2.x (SunOS 5.x) system
  45.      program that can be exploited to gain root access if the user has access
  46.      to the temporary files.  Access to temporary files may be obtained if the
  47.      permissions on the /tmp and /var/tmp directories are set incorrectly. 
  48.      The permissions on the /tmp directory are often reset incorrectly by
  49.      the system if tmpfs (which is mounting swap as /tmp) is in use.
  50.  
  51. II.  Impact
  52.  
  53.      Users logged in to the system may gain unauthorized root privileges.
  54.      
  55. III. Solution
  56.      
  57.      A. Determine if your system is vulnerable
  58.  
  59.         To determine if you are running tmpfs, the following command can be
  60.         used to verify if the filesystem for /tmp is swap:
  61.  
  62.           % /usr/sbin/df -k /tmp
  63.           Filesystem          kbytes    used   avail capacity  Mounted on
  64.           swap                 28348     12    28336     0%    /tmp
  65.  
  66.         or look in the file /etc/vfstab for the configuration line:
  67.  
  68.           #device     device   mount    FS      fsck    mount     mount
  69.           #to mount   to fsck  point    type    pass    at boot   options
  70.           swap          -      /tmp     tmpfs     -      yes         -
  71.  
  72.         If either of these two conditions exist, then you are running tmpfs
  73.         and the system may automatically reset the permission bits of /tmp at
  74.         the next reboot.
  75.  
  76.         To verify if your configuration is currently vulnerable, the following
  77.         command may be used:
  78.  
  79.           % /usr/bin/ls -ld /tmp
  80.           drwxrwxrwt   2 sys      sys        61 Aug 15 12:12 /tmp
  81.  
  82.         If the sticky bit (t) is not set (it will be an x), then the system is
  83.         vulnerable.
  84.  
  85.      B. Perform the following workarounds
  86.  
  87.         These workarounds have been verified with Sun Microsystems. Sun
  88.         Microsystems expects to release a patch in the near future.
  89.  
  90.         1. Immediate - fix /tmp permissions
  91.  
  92.            A workaround that takes effect immediately is to set the sticky bit
  93.            on the /tmp directory using the following command as root:
  94.  
  95.              # /usr/bin/chmod 1777 /tmp
  96.  
  97.            Note that this command must be performed after each reboot if you
  98.            are mounting swap as /tmp (using tmpfs).
  99.  
  100.            In addition, the ownership and group membership of the /tmp
  101.            directory should be verified using /usr/bin/ls -ld /tmp, and if
  102.            incorrect may be reset by: 
  103.  
  104.              # /usr/bin/chown sys /tmp
  105.              # /usr/bin/chgrp sys /tmp
  106.  
  107.            The AUSCERT UNIX Security Checklist addresses this issue in
  108.            Section 5.5.  This section is reproduced in the appendix of this
  109.            advisory. The entire AUSCERT checklist may be obtained from these
  110.            locations.
  111.           
  112.            Sites outside of Australia should use the info.cert.org FTP site.
  113.  
  114.        ftp://info.cert.org/pub/tech_tips/AUSCERT_checklist_1.0
  115.        ftp://ftp.auscert.org.au/pub/auscert/papers/unix_security_checklist_1.0
  116.     
  117.  
  118.         2. Permanent - make the above change to /tmp permissions permanent
  119.  
  120.            The change noted in item B.1 above will be lost upon reboot. To
  121.            make the changes permanent, create the following script as
  122.            /etc/init.d/tmpfsfix: 
  123.  
  124. -----------------------------cut here--8<-------------------------------------
  125. #!/bin/sh
  126.  
  127. if [ -d /tmp ]
  128. then
  129.    /usr/bin/chmod 1777 /tmp
  130.    /usr/bin/chgrp sys /tmp
  131.    /usr/bin/chown sys /tmp
  132. fi
  133. ------------------------------cut here---8<-----------------------------------
  134.  
  135.           A symbolic link should then be created called
  136.           /etc/rc3.d/S79tmpfix which points to /etc/init.d/tmpfsfix by issuing
  137.           the following command as root:
  138.  
  139.             # /usr/bin/ln -s /etc/init.d/tmpfsfix /etc/rc3.d/S79tmpfix
  140.  
  141.           If you have done item B.1 above, you can reboot at your leisure.
  142.           Otherwise, reboot your system now. In either case, verify the 
  143.           permissions of /tmp immediately after your next system reboot.
  144.  
  145.        3. Check /var/tmp permissions
  146.  
  147.           We recommend that you also check and correct the /var/tmp directory.
  148.           Note that this directory is not usually mounted as tmpfs, so
  149.           it normally would not be subject to automatic resetting of its
  150.           permission bits on reboot. 
  151.  
  152.             % /usr/bin/ls -ld /var/tmp
  153.             drwxrwxrwt   2 sys      sys       512 Aug 15 11:35 /var/tmp
  154.  
  155. ----------------------------------------------------------------------------
  156. The CERT Coordination Center staff thanks AUSCERT, the Australian response
  157. team, for their permission to reuse text from their advisory AA-95.07 and 
  158. for their cooperation and assistance.
  159. ----------------------------------------------------------------------------
  160.  
  161. If you believe that your system has been compromised, contact the CERT
  162. Coordination Center or your representative in the Forum of Incident
  163. Response and Security Teams (FIRST).
  164.  
  165. If you wish to send sensitive incident or vulnerability information to
  166. CERT staff by electronic mail, we strongly advise that the email be
  167. encrypted.  The CERT Coordination Center can support a shared DES key, PGP
  168. (public key available via anonymous FTP on info.cert.org), or PEM (contact
  169. CERT staff for details).
  170.  
  171. Internet email: cert@cert.org
  172. Telephone: +1 412-268-7090 (24-hour hotline)
  173.            CERT personnel answer 8:30 a.m.-5:00 p.m. EST(GMT-5)/EDT(GMT-4),
  174.            and are on call for emergencies during other hours.
  175. Fax: +1 412-268-6989
  176.  
  177. Postal address:  CERT Coordination Center
  178.                  Software Engineering Institute
  179.                  Carnegie Mellon University
  180.                  Pittsburgh, PA 15213-3890
  181.                  USA
  182.  
  183. CERT advisories and bulletins are posted on the USENET newsgroup
  184. comp.security.announce. If you would like to have future advisories and
  185. bulletins mailed to you or to a mail exploder at your site, please send mail
  186. to cert-advisory-request@cert.org.
  187.  
  188. Past CERT publications, information about FIRST representatives, and
  189. other information related to computer security are available for anonymous
  190. FTP from info.cert.org. 
  191.  
  192. This material may be reproduced and distributed without permission provided it
  193. is used for noncommercial purposes, and the CERT Coordination Center and
  194. AUSCERT are acknowledged.
  195.  
  196. CERT is a service mark of Carnegie Mellon University.
  197.  
  198. ..............................................................................
  199. Appendix: Excerpt from AUSCERT UNIX Security Checklist (Version 1.0)
  200.  
  201.  5.5  File Permissions
  202.  
  203.    *    CHECK that the permissions of /etc/utmp are set to 644.
  204.    *    CHECK that the permissions of /etc/sm and /etc/sm.bak are set to 2755.
  205.    *    CHECK that the permissions of /etc/state are set to 644.
  206.    *    CHECK that the permissions of /etc/motd and /etc/mtab are set to 644.
  207.    *    CHECK that the permissions of /etc/syslog.pid are set to 644.
  208.    *    REMOVE setgid privileges on /usr/kvm/crash.
  209.             A group of kmem allows users to read the virtual memory of a
  210.             running system.
  211.                 # /bin/chmod g-s /usr/kvm/crash
  212.    *    DO consider removing read access to files that users do not need to
  213.         access.
  214.    *    ENSURE that the kernel (eg. /vmunix) is owned by root, has group set
  215.         to 0 (wheel on SunOS) and permissions set to 644.
  216.    *    ENSURE that /etc, /bin, /usr/etc, /usr/bin and /tmp are owned by
  217.         root [Note from CERT Coordination Center: "root" applies to SunOS; 
  218.         "sys" applies to Solaris]  and that the sticky-bit is set on /tmp.
  219.             ie. permissions on /tmp should be:  drwxrwxrwt.
  220.             You should implement COPS or Tiger to check for this.
  221.             Refer to section B.2 [of the AUSCERT UNIX Security Checklist] for 
  222.             information where to obtain these.
  223.  
  224.    *    ENSURE that there are no unexpected world writable files or
  225.         directories on your system.  The following commands find world
  226.         writeable files and directories.
  227.  
  228.                # /bin/find / -type f -perm -22 -exec ls -l {} \;
  229.                # /bin/find / -type d -perm -22 -exec ls -ld {} \;
  230.  
  231.    *    CHECK that files which have the SUID or SGID bit enabled, should have
  232.         it enabled:
  233.                # /bin/find / -type f \( -perm -004000 -o -perm -002000 \) \
  234.                       -exec ls -l {} \;
  235.  
  236.    *    CHECK the umask value for each user and ensure it is set to
  237.         something sensible like 027 or 077.  Refer to section E.1 [of the 
  238.         AUSCERT UNIX Security Checklist] for a shell script to check this.
  239.  
  240.  
  241.