-----BEGIN PGP SIGNED MESSAGE----- =============================================================================== Security Advisory CERT-NL =============================================================================== Author/Source : Gert Meijerink Index : S-97-36 Distribution : World Page : 1 Classification: External Version: 1 Subject : Solaris ps Buffer Overflow Vulnerability Date : 14-May-97 =============================================================================== By courtesy of AUSCERT we received information on a vulnerability in Solaris 2.x ps(1) program. CERT-NL recommends, due to lack of adequate vendor patches, to apply the workarounds provided in section 3. And to install the official vendor patches when they are made available. =========================================================================== AA-97.17 AUSCERT Advisory Solaris 2.x ps Buffer Overflow Vulnerability 21 May 1997 Last Revised: - - ---------------------------------------------------------------------------- AUSCERT has received information that a vulnerability exists in the ps(1) program under Solaris 2.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 Solaris 2.x ps(1) program. ps is a program used to print information about active processes on the system. Due to insufficient bounds checking on arguments passed to the ps program, it is possible to overwrite the internal data space of this program while it is executing. This vulnerability may allow local users to gain root privileges. Exploit information involving this vulnerability has been made publicly available. Under Solaris 2.x there are two distinct vulnerable versions of ps. These are installed by default in /usr/bin/ and /usr/ucb/. Sun Microsystems is aware of this problem and is currently investigating it. 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 workaround given in Section 3.1. To maintain the functionality of ps, AUSCERT recommends applying the workaround given in Section 3.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 Remove setuid and non-root execute permissions To prevent the exploitation of the vulnerability described in this advisory, AUSCERT recommends that the setuid permissions be removed from ps program immediately. As the ps program will no longer work for non-root users, it is recommended that the execute permissions for them also be removed. # ls -l /usr/bin/ps /usr/ucb/ps -r-sr-xr-x 1 root sys 23752 Oct 25 1995 /usr/bin/ps -rwsr-xr-x 1 root sys 23408 Oct 25 1995 /usr/ucb/ps # chmod 500 /usr/bin/ps /usr/ucb/ps # ls -l /usr/bin/ps /usr/ucb/ps -r-x------ 1 root sys 23752 Oct 25 1995 /usr/bin/ps -r-x------ 1 root sys 23408 Oct 25 1995 /usr/ucb/ps 3.2 Install wrapper AUSCERT has developed a wrapper to help prevent programs from being exploited using the vulnerability described in this advisory. Sites which have a C compiler can obtain the source, compile and install the wrapper as described in Section 3.2.1. For sites without a C compiler, AUSCERT has made pre-compiled binaries available for Solaris 2.4, 2.5 and 2.5.1 (Section 3.2.2). 3.2.1 Installing the wrapper from source The source for the wrapper, including installation instructions, can be obtained from: ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper/ overflow_wrapper.c This wrapper replaces the ps 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 ps command. The wrapper program can also be configured to syslog any failed attempts to execute ps with arguments exceeding MAXARGLEN. For further instructions on using this wrapper, please read the comments at the top of overflow_wrapper.c. The wrapper will need to be applied to both ps programs on the system (/usr/bin/ps and /usr/ucb/ps). When compiling overflow_wrapper.c for use with ps, AUSCERT recommends defining MAXARGLEN to be 32. The MD5 checksum for the current version of overflow_wrapper.c can be retrieved from: ftp://ftp.auscert.org.au/pub/auscert/tools/overflow_wrapper/CHECKSUM The CHECKSUM file has been digitally signed using the AUSCERT PGP key. 3.2.2 Installing the wrapper binaries Pre-compiled wrapper binaries are provided for sites that wish to install the wrapper but do not have a C compiler available. AUSCERT has compiled the wrapper on Solaris 2.4, 2.5 and 2.5.1. The following compile time options have been used to the create the binaries: REAL_PROG='"/usr/bin/ps.real"' MAXARGLEN=32 SYSLOG and REAL_PROG='"/usr/ucb/ps.real"' MAXARGLEN=32 SYSLOG More information on these options can be found in Section 3.2.1 and in the overflow_wrapper.c source code. The pre-compiled binaries for the wrapper program can be retrieved from: ftp://ftp.auscert.org.au/pub/auscert/tools/ps_wrapper.tar.Z The MD5 checksum for ps_wrapper.tar.Z is: MD5 (ps_wrapper.tar.Z) = 6c0a9a2739561aba5968fc54b10d8c32 ps_wrapper.tar.Z contains a README file with installation instructions, as well as pre-compiled binaries for /usr/bin/ps and /usr/ucb/ps under Solaris 2.4, 2.5 and 2.5.1. The binaries have been linked statically so they are larger than the default ps binary. Sites are encouraged to carefully read the installation notes in the README file before installation. - - ---------------------------------------------------------------------------- AUSCERT thanks Nelson Marques (The University of Queensland) for his assistance in this matter. - - ---------------------------------------------------------------------------- ============================================================================== 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: 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 iQCVAwUBM4NFd0U5nQkWIq1FAQHQZgQA1kldzlmcd1w19NtKKiS1e3eHWZsxAuy3 AhbshKZbXKV0o5CNLzNUeK1/wBagZdGcOWUMvbCR8pidUg0fqtYqhFKjIO2Q7kPd 1z4fzQO24I1M9uvSvmvgbx8iA+LLTkOcaqOFbVL/Naa3Ug05VkVXc/x1kyAshq89 EHBzZff6SHA= =f63t -----END PGP SIGNATURE-----