__________________________________________________________ The U.S. Department of Energy Computer Incident Advisory Capability ___ __ __ _ ___ / | /_\ / \___ __|__ / \ \___ __________________________________________________________ INFORMATION BULLETIN OpenSSH Challenge Response Vulnerabilities [OpenSSH Security Advisory 2nd Revision] June 27, 2002 19:00 GMT Number M-095 [Revised 9 July 2002] ______________________________________________________________________________ PROBLEM: Two vulnerabilities exist in OpenSSH challenge response handling code. The first vulnerability is an integer overflow in the handling of the number of responses received during challenge response authentication. The second vulnerability is a buffer overflow involving the number of responses received during challenge response authentication. AFFECTED VERSIONS: OpenSSH 2.3.1 through 3.3 PLATFORM: See CERT's Security Advisory CA-2002-18 for vendor updates and recommendations. http://www.cert.org/advisories/CA-2002-18.html DAMAGE: The vulnerabilities can be exploited remotely and allow an attacker to execute arbitrary code. These vulnerabilities may also cause a denial-of-service attack. SOLUTION: Upgrade to OpenSSH 3.4, apply the patches recommended by OpenSSH, or see your platform vendor's particular recommendations. ______________________________________________________________________________ VULNERABILITY The risk is HIGH. A remote attacker can execute code of choice ASSESSMENT: with the privilege of running the sshd, often root. ______________________________________________________________________________ LINKS: CIAC BULLETIN: http://www.ciac.org/ciac/bulletins/m-095.shtml ORIGINAL BULLETIN: http://openssh.org/txt/preauth.adv CERT BULLETIN: http://www.cert.org/advisories/CA-2002-18.html ______________________________________________________________________________ [***** Start OpenSSH Security Advisory 2nd Revision *****] Subject: Revised OpenSSH Security Advisory (adv.iss) This is the 4th revision of the Advisory. 1. Versions affected: Serveral versions of OpenSSH's sshd between 2.3.1 and 3.3 contain an input validation error that can result in an integer overflow and privilege escalation. All versions between 2.3.1 and 3.3 contain a bug in the PAMAuthenticationViaKbdInt code. All versions between 2.9.9 and 3.3 contain a bug in the ChallengeResponseAuthentication code. OpenSSH 3.4 and later are not affected. OpenSSH 3.2 and later prevent privilege escalation if UsePrivilegeSeparation is enabled in sshd_config. OpenSSH 3.3 enables UsePrivilegeSeparation by default. Although some earlier versions are not affected upgrading to OpenSSH 3.4 is recommended, because OpenSSH 3.4 adds checks for a class of potential bugs. 2. Impact: This bug can be exploited remotely if ChallengeResponseAuthentication is enabled in sshd_config. This option is enabled by default on OpenBSD and other systems. Affected are at least systems supporting s/key over SSH protocol version 2 (OpenBSD, FreeBSD and NetBSD as well as other systems supporting s/key with SSH). Exploitablitly of systems using PAMAuthenticationViaKbdInt has not been verified. 3. Short-Term Solution: Disable ChallengeResponseAuthentication in sshd_config. and Disable PAMAuthenticationViaKbdInt in sshd_config. Alternatively you can prevent privilege escalation if you enable UsePrivilegeSeparation in sshd_config. 4. Solution: Upgrade to OpenSSH 3.4 or apply the following patches. 5. Credits: ISS. Appendix: A: Index: auth2-chall.c =================================================================== RCS file: /cvs/src/usr.bin/ssh/auth2-chall.c,v retrieving revision 1.18 diff -u -r1.18 auth2-chall.c --- auth2-chall.c 19 Jun 2002 00:27:55 -0000 1.18 +++ auth2-chall.c 26 Jun 2002 09:37:03 -0000 @@ -256,6 +256,8 @@ authctxt->postponed = 0; /* reset */ nresp = packet_get_int(); + if (nresp > 100) + fatal("input_userauth_info_response: nresp too big %u", nresp); if (nresp > 0) { response = xmalloc(nresp * sizeof(char*)); for (i = 0; i < nresp; i++) B: Index: auth2-pam.c =================================================================== RCS file: /var/cvs/openssh/auth2-pam.c,v retrieving revision 1.12 diff -u -r1.12 auth2-pam.c --- auth2-pam.c 22 Jan 2002 12:43:13 -0000 1.12 +++ auth2-pam.c 26 Jun 2002 10:12:31 -0000 @@ -140,6 +140,15 @@ nresp = packet_get_int(); /* Number of responses. */ debug("got %d responses", nresp); + + if (nresp != context_pam2.num_expected) + fatal("%s: Received incorrect number of responses " + "(expected %u, received %u)", __func__, nresp, + context_pam2.num_expected); + + if (nresp > 100) + fatal("%s: too many replies", __func__); + for (i = 0; i < nresp; i++) { int j = context_pam2.prompts[i]; [***** End OpenSSH Security Advisory 2nd Revision *****] _______________________________________________________________________________ CIAC wishes to acknowledge the contributions of OpenBSD 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 925-422-8193 (7x24) FAX: +1 925-423-8002 STU-III: +1 925-423-2604 E-mail: ciac@ciac.org Previous CIAC notices, anti-virus software, and other information are available from the CIAC Computer Security Archive. World Wide Web: http://www.ciac.org/ Anonymous FTP: ftp.ciac.org 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 via WWW at http://www.first.org/. 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) CIACTech02-004: Parasite Programs; Adware, Spyware, and Stealth Networks M-086: Sun SEA SNMP Vulnerability M-087: SGI IRIX rpc.passwd Vulnerability M-088: MS Unchecked Buffer in Gopher Protocol Handler M-089: MS Heap Overrun in HTR Chunked Encoding Vulnerability M-090: Microsoft Unchecked Buffer in RAS Phonebook Vulnerability M-091: Microsoft Unchecked Buffer in SQLXML Vulnerability M-092: Cisco Buffer Overflow in UNIX VPN Client M-093: Apache HTTP Server Chunk Encoding Vulnerability M-094: Microsoft SQL Server 2000 OpenDataSource Buffer Overflow