|
__________________________________________________________ The U.S. Department of Energy Computer Incident Advisory Capability ___ __ __ _ ___ / | /_\ / \___ __|__ / \ \___ __________________________________________________________ INFORMATION BULLETIN HP-UX Security Vulnerabilities (passwd, fpkg2swpkg, newgrp) December 6, 1996 23:00 GMT Number H-10 ______________________________________________________________________________ PROBLEM: Three vulnerabilities have been found in the HP-UX operating system: 1) passwd buffer overrun, 2) fpkg2swpkg program, and 3) newgrp buffer overrun. PLATFORM: HP-UX 9.x and HP-UX 10.x DAMAGE: Vulnerabilities may allow local users to gain root privileges. SOLUTION: Install the proper patches and/or use the workarounds provided below. ______________________________________________________________________________ VULNERABILITY Exploit information involving these vulnerabilities have been ASSESSMENT: made publicly available. ______________________________________________________________________________ [ Begin AUSCERT Advisories ] 1. passwd Buffer Overrun Vulnerability =========================================================================== AA-96.13 AUSCERT Advisory HP-UX passwd Buffer Overrun Vulnerability 28 November 1996 Last Revised: 5 December 1996 Remove permissions on /sbin/passwd as it is also vulnerable. Replace wrapper program with pointer to overflow_wrapper.c (no change in functionality). ---------------------------------------------------------------------------- AUSCERT has received information that a vulnerability exists in the passwd(1) program under HP-UX 9.x and HP-UX 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 passwd(1) program. This vulnerability is known to affect HP-UX 9.x and 10.x. Due to insufficient bounds checking on arguments which are supplied by users, it is possible to overwrite the internal stack space of the passwd program while it is executing. By supplying a carefully designed argument to the passwd program, intruders may be able to force passwd to execute arbitrary commands. As passwd is setuid root, it may allow intruders to run arbitrary commands with root privileges. By default, a dynamically linked version of the passwd program is found in /bin under HP-UX 9.x and in /usr/bin under HP-UX 10.x. A statically linked version is also available under HP-UX 10.x and is located in /sbin. 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 applying the workarounds given in Sections 3.1.1 and 3.1.2. Sites using either HP-UX 9.x or HP-UX 10.x will need to apply the workaround given in Section 3.1.1. In addition, sites using HP-UX 10.x will also need to apply the workaround given in Section 3.1.2. 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.1 Install passwd wrapper AUSCERT has developed a wrapper 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 wrapper replaces the passwd program and checks the length of the command line arguments which are passed to it. If an argument exceeds a certain predefined value (MAXARGLEN), the wrapper exits without executing the passwd command. The wrapper program can also be configured to syslog any failed attempts to execute passwd 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 passwd, AUSCERT recommends defining MAXARGLEN to be 64. 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 apply this workaround. The overflow_wrapper.c program provides functionality identical to passwd_wrapper.c included in the previous version of this advisory. Sites that have already installed passwd_wrapper.c do not need to install overflow_wrapper.c. Sites using HP-UX 10.x will need to additionally apply the workaround given in Section 3.1.2. 3.1.2 Remove setuid and non-root execute permissions on /sbin/passwd Under HP-UX 10.x, a statically linked copy of the passwd program is located in /sbin. This copy of the passwd program is available for root to use when only the root partition is mounted, for example, when in single user mode. There is no need for non-root users to use this copy of the passwd program, so setuid and non-root execute permissions should be removed. # ls -l /sbin/passwd -r-sr-xr-x 1 root bin 487424 Jun 10 17:00 /sbin/passwd # chmod 500 /sbin/passwd # ls -l /sbin/passwd -r-x------ 1 root bin 487424 Jun 10 17:00 /sbin/passwd Note this will remove the ability for non-root users to execute /sbin/passwd. 4. Additional measures During the installation of HP-UX patches, copies of files being replaced are saved in case the patches need to be backed out of. The original versions of patched files are stored in the following locations: HP-UX 9.x: /system/<PATCH-NAME>/orig/ HP-UX 10.x: /var/adm/sw/patch/PATCH_NAME>/ If patches for vulnerable programs have been previously installed, copies of the vulnerable programs may be available in the above locations. Sites should ensure the directories have permissions which restrict access to the patch areas. ---------------------------------------------------------------------------- AUSCERT thanks Hewlett-Packard for their continued assistance and technical expertise essential for the production of this advisory. AUSCERT also thanks Information Technology Services of the University of Southern Queensland, Albert Lunde (Northwestern University) and CERT/CC for their assistance. ---------------------------------------------------------------------------- 2. fpkg2swpkg Program Vulnerability =========================================================================== AA-96.14 AUSCERT Advisory HP-UX fpkg2swpkg Vulnerability 29 November 1996 Last Revised: -- ---------------------------------------------------------------------------- AUSCERT has received information that a vulnerability exists in the HP-UX 10.x program fpkg2swpkg. This vulnerability may allow local users to gain root privileges. Exploit information involving this vulnerability has been made publicly available. At this stage, AUSCERT is unaware of any official vendor patches. AUSCERT recommends that sites apply the workaround given in Section 3 until vendor patches are made available. This advisory will be updated as more information becomes available. ---------------------------------------------------------------------------- 1. Description The HP-UX 10.x fpkg2swpkg(1m) program is used to translate fpkg (HP-UX 9.x) network media or Product Specification Files (PSFs) to SD swpackage (HP-UX 10.x) PSFs. The fpkg2swpkg program creates files in an insecure manner. As this program executes with root privileges, it is possible for local users to create or append to arbitrary files on the system. Exploit information involving this vulnerability has been made publicly available. The default location for fpkg2swpkg is /usr/sbin/fpkg2swpkg. 2. Impact Local users may be able to create or append to arbitrary files on the system. This can be leveraged to gain root privileges. 3. Workarounds/Solution AUSCERT recommends that sites prevent the exploitation of the vulnerability in fpkg2swpkg by immediately applying the workaround given in Section 3.1. 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 execute permissions Until official vendor patches are made available, sites should remove the setuid root and execute permissions from fpkg2swpkg. To do this, the following command should be run as root: # chmod 400 /usr/sbin/fpkg2swpkg # ls -l /usr/sbin/fpkg2swpkg -r-------- 1 root bin 57344 May 30 1996 /usr/sbin/fpkg2swpkg Note that this will remove the ability for any user to run this program. If only the setuid permissions are removed, it is still possible for users to gain privileges when fpkg2swpkg is executed by the root user. 4. Additional measures Most Unix systems ship with 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 fpkg2swpkg program is not needed by most sites. If sites had previously disabled the fpkg2swpkg 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. AUSCERT also thanks Information Technology Services of the University of Southern Queensland for their assistance. ---------------------------------------------------------------------------- 3. newgrp Buffer Overrun Vulnerability =========================================================================== AA-96.16 AUSCERT Advisory HP-UX newgrp Buffer Overrun Vulnerability 3 December 1996 Last Revised: -- ---------------------------------------------------------------------------- AUSCERT has received information that a vulnerability exists in the newgrp(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 newgrp(1) program. The newgrp command is used to change a users group identification, 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 newgrp program while it is executing. By supplying a carefully designed argument to the newgrp program, intruders may be able to force newgrp to execute arbitrary commands. As newgrp 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, newgrp is located in /bin under HP-UX 9.x and in /usr/bin under HP-UX 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 newgrp command is required, AUSCERT recommends the newgrp 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 newgrp program immediately. As the newgrp 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 newgrp should be noted as they will be needed if sites choose to install the newgrp wrapper program (Section 3.2). For HP-UX 9.x: # ls -l /bin/newgrp -r-sr-xr-x 1 root sys 16384 Dec 2 13:45 /bin/newgrp # chmod 500 /bin/newgrp # ls -l /bin/newgrp -r-x------ 1 root sys 16384 Dec 2 13:45 /bin/newgrp For HP-UX 10.x: # ls -l /usr/bin/newgrp -r-sr-xr-x 1 root sys 12288 Dec 2 13:27 /usr/bin/newgrp # chmod 500 /usr/bin/newgrp # ls -l /usr/bin/newgrp -r-x------ 1 root sys 12288 Dec 2 13:27 /usr/bin/newgrp Note that this will remove the ability for any non-root user to run the newgrp program. 3.2 Install newgrp wrapper AUSCERT has developed a wrapper 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 newgrp 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 newgrp command. The wrapper program can also be configured to syslog any failed attempts to execute newgrp 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 newgrp, 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 newgrp functionality apply this workaround. ---------------------------------------------------------------------------- AUSCERT thanks Hewlett-Packard for their continued assistance and technical expertise essential for the production of this advisory. AUSCERT also thanks Information Technology Services of the University of Southern Queensland for their assistance. ---------------------------------------------------------------------------- [ End AUSCERT Advisories ] _______________________________________________________________________________ CIAC wishes to acknowledge the contributions of AUSCERT for the information contained in this bulletin. _______________________________________________________________________________ CIAC, the Computer Incident Advisory Capability, is the computer security incident response team for the U.S. Department of Energy (DOE) and the emergency backup response team for the National Institutes of Health (NIH). CIAC is located at the Lawrence Livermore National Laboratory in Livermore, California. CIAC is also a founding member of FIRST, the Forum of Incident Response and Security Teams, a global organization established to foster cooperation and coordination among computer security teams worldwide. CIAC services are available to DOE, DOE contractors, and the NIH. CIAC can be contacted at: Voice: +1 510-422-8193 FAX: +1 510-423-8002 STU-III: +1 510-423-2604 E-mail: ciac@llnl.gov For emergencies and off-hour assistance, DOE, DOE contractor sites, and the NIH may contact CIAC 24-hours a day. During off hours (5PM - 8AM PST), call the CIAC voice number 510-422-8193 and leave a message, or call 800-759-7243 (800-SKY-PAGE) to send a Sky Page. CIAC has two Sky Page PIN numbers, the primary PIN number, 8550070, is for the CIAC duty person, and the secondary PIN number, 8550074 is for the CIAC Project Leader. Previous CIAC notices, anti-virus software, and other information are available from the CIAC Computer Security Archive. World Wide Web: http://ciac.llnl.gov/ Anonymous FTP: ciac.llnl.gov (128.115.19.53) Modem access: +1 (510) 423-4753 (28.8K baud) +1 (510) 423-3331 (28.8K baud) CIAC has several self-subscribing mailing lists for electronic publications: 1. CIAC-BULLETIN for Advisories, highest priority - time critical information and Bulletins, important computer security information; 2. CIAC-NOTES for Notes, a collection of computer security articles; 3. SPI-ANNOUNCE for official news about Security Profile Inspector (SPI) software updates, new features, distribution and availability; 4. SPI-NOTES, for discussion of problems and solutions regarding the use of SPI products. Our mailing lists are managed by a public domain software package called ListProcessor, which ignores E-mail header subject lines. To subscribe (add yourself) to one of our mailing lists, send the following request as the E-mail message body, substituting CIAC-BULLETIN, CIAC-NOTES, SPI-ANNOUNCE or SPI-NOTES for list-name and valid information for LastName FirstName and PhoneNumber when sending E-mail to ciac-listproc@llnl.gov: subscribe list-name LastName, FirstName PhoneNumber e.g., subscribe ciac-notes OHara, Scarlett W. 404-555-1212 x36 You will receive an acknowledgment containing address, initial PIN, and information on how to change either of them, cancel your subscription, or get help. PLEASE NOTE: Many users outside of the DOE, ESnet, and NIH computing communities receive CIAC bulletins. If you are not part of these communities, please contact your agency's response team to report incidents. Your agency's team will coordinate with CIAC. The Forum of Incident Response and Security Teams (FIRST) is a world-wide organization. A list of FIRST member organizations and their constituencies can be obtained by sending email to docserver@first.org with an empty subject line and a message body containing the line: send first-contacts. This document was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the University of California nor any of their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial products, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation or favoring by the United States Government or the University of California. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or the University of California, and shall not be used for advertising or product endorsement purposes. LAST 10 CIAC BULLETINS ISSUED (Previous bulletins available from CIAC) G-47: Unix FLEXlm Vulnerabilities G-48: TCP SYN Flooding and IP Spoofing Attacks H-01: Vulnerabilities in bash H-02: SUN's TCP SYN Flooding Solutions H-03: HP-UX_suid_Vulnerabilities H-04: HP-UX Ping Vulnerability H-05: Internet Hoaxes H-07: Sendmail SIGHUP-smtpd Vulnerability H-08: lpr Buffer Overrun Vulnerability H-09: HP 9000 Access Vulnerability RECENT CIAC NOTES ISSUED (Previous Notes available from CIAC) Notes 07 - 3/29/95 A comprehensive review of SATAN Notes 08 - 4/4/95 A Courtney update Notes 09 - 4/24/95 More on the "Good Times" virus urban legend Notes 10 - 6/16/95 PKZ300B Trojan, Logdaemon/FreeBSD, vulnerability in S/Key, EBOLA Virus Hoax, and Caibua Virus Notes 11 - 7/31/95 Virus Update, Hats Off to Administrators, America On-Line Virus Scare, SPI 3.2.2 Released, The Die_Hard Virus Notes 12 - 9/12/95 Securely configuring Public Telnet Services, X Windows, beta release of Merlin, Microsoft Word Macro Viruses, Allegations of Inappropriate Data Collection in Win95 Notes 96-01 - 3/18/96 Java and JavaScript Vulnerabilities, FIRST Conference Announcement, Security and Web Search Engines, Microsoft Word Macro Virus Update