-----BEGIN PGP SIGNED MESSAGE----- - -----BEGIN PGP SIGNED MESSAGE----- =============================================================================== Security Advisory CERT-NL =============================================================================== Author/Source : Olav ten Bosch Index : S-96-77 Distribution : World Page : 1 Classification: External Version: 1 Subject : HP-UX chfn Buffer Overrun Vulnerability Date : 09-Dec-96 =============================================================================== By courtesy of AUSCERT we received information on a vulnerability in the chfn(1) program under HP-UX 9.x and 10.x. CERT-NL recommends do act as specified below. =========================================================================== AA-96.18 AUSCERT Advisory HP-UX chfn Buffer Overrun Vulnerability 9 December 1996 Last Revised: -- - ------------------------------------------------------------------------------ AUSCERT has received information that a vulnerability exists in the chfn(1) program under HP-UX 9.x and 10.x. This vulnerability may allow local users to gain root privileges. Exploit information involving this vulnerability has been made publicly available. Currently there are no vendor patches available that address this vulnerability. AUSCERT recommends that sites take the steps outlined in section 3 as soon as possible. This advisory will be updated as more information becomes available. - ------------------------------------------------------------------------------ 1. Description AUSCERT has received information that a vulnerability exists in the HP-UX chfn(1) program. The chfn command is used to change user information in the password file, and is installed by default. Due to insufficient bounds checking on arguments which are supplied by users, it is possible to overwrite the internal stack space of the chfn program while it is executing. By supplying a carefully designed argument to the chfn program, intruders may be able to force chfn to execute arbitrary commands. As chfn is setuid root, this may allow intruders to run arbitrary commands with root privileges. This vulnerability is known to affect both HP-UX 9.x and 10.x. By default, chfn is located in /usr/bin under both HP-UX 9.x and 10.x. Exploit information involving this vulnerability has been made publicly available. 2. Impact Local users may gain root privileges. 3. Workarounds/Solution AUSCERT recommends that sites limit the possible exploitation of this vulnerability by immediately removing the setuid permissions as stated in Section 3.1. If the chfn command is required, AUSCERT recommends the chfn wrapper program given in Section 3.2 be installed. Currently there are no vendor patches available that address this vulnerability. AUSCERT recommends that official vendor patches be installed when they are made available. 3.1 Remove setuid and non-root execute permissions To prevent the exploitation of the vulnerability described in the advisory, AUSCERT recommends that the setuid permissions be removed from the chfn program immediately. As the chfn program will no longer work for non-root users, it is recommended that the execute permissions also be removed. Before doing so, the original permissions for chfn should be noted as they will be needed if sites choose to install the chfn wrapper program (Section 3.2). For example: # ls -l /usr/bin/chfn -r-sr-xr-x 1 root bin 20480 Jun 10 1996 /usr/bin/chfn # chmod 500 /usr/bin/chfn # ls -l /usr/bin/chfn -r-x------ 1 root bin 20480 Jun 10 1996 /usr/bin/chfn Note that this will remove the ability for any non-root user to run the chfn program. 3.2 Install chfn wrapper AUSCERT has developed a wrapper program to help prevent programs from being exploited using the vulnerability described in this advisory. This wrapper, including installation instructions, can be found at: ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper.c This replaces the chfn program with a wrapper which checks the length of the command line arguments passed to it. If an argument exceeds a certain predefined value (MAXARGLEN), the wrapper exits without executing the chfn command. The wrapper program can also be configured to syslog any failed attempts to execute chfn with arguments exceeding MAXARGLEN. For further instructions on using this wrapper, please read the comments at the top of overflow_wrapper.c. When compiling overflow_wrapper.c for use with HP-UX chfn, AUSCERT recommends defining MAXARGLEN to be 16. The MD5 checksum for Version 1.0 of overflow_wrapper.c is: MD5 (overflow_wrapper.c) = f7f83af7f3f0ec1188ed26cf9280f6db AUSCERT recommends that until vendor patches can be installed, sites requiring the chfn functionality apply this workaround. 4. Additional measures Most Unix systems ship numerous programs which have setuid or setgid privileges. Often the functionality supplied by these privileged programs is not required by many sites. The large number of privileged programs that are shipped by default are to cater for all possible uses of the system. AUSCERT encourages sites to examine all the setuid/setgid programs and determine the necessity of each program. If a program does not absolutely require the setuid/setgid privileges to operate (for example, it is only run by the root user), the setuid/setgid privileges should be removed. Furthermore, if a program is not required at your site, then all execute permissions should be removed. A sample command to find all setuid/setgid programs is (run as root): # find / \( -perm -4000 -o -perm -2000 \) -exec ls -ld {} \; It is AUSCERT's experience that many vulnerabilities are being discovered in setuid/setgid programs which are not necessary for the correct operation of most systems. Sites can increase their security by removing unnecessary setuid/setgid programs. For example, the functionality provided by the chfn program is not needed by many sites since the user information stored in the password file, which chfn is used to change, is typically static. If sites had previously disabled the chfn program, they would not have been vulnerable to this latest exploit. - ------------------------------------------------------------------------------ AUSCERT thanks Hewlett-Packard for their continued assistance and technical expertise essential for the production of this advisory. - ------------------------------------------------------------------------------ ============================================================================== 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://www.surfnet.nl/surfnet/security/cert-nl.html ftp://ftp.surfnet.nl/surfnet/net-security 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 Phone: +31 302 305 305 Fax: +31 302 305 329 Snailmail: SURFnet bv Attn. CERT-NL P.O. Box 19035 NL - 3501 DA UTRECHT The Netherlands A 7 * 24 hours phone number is available to SURFnet SSC's and FIRST members on request. ============================================================================== -----BEGIN PGP SIGNATURE----- Version: 2.6.3i Charset: cp850 iQCVAwUBMqw1/GL2fnkJN/jpAQFtNgP+Jzx2+KXoNm1UQTmMbv6mHpZ/xB1MA9dg xMvwuWB2ljLrDWUQJYUGDIva3iTn2woxjKLPVjlntPcTnKngneHTyKab9p8RPiar IOc9O20j5nHr5d9iZOSVqlB+0Meb4syi0aezB1h3CCpomoVsyf+2iTtU+TC3SzsU nLg7OnPHxe8= =D3U2 -----END PGP SIGNATURE-----