__________________________________________________________ The U.S. Department of Energy Computer Incident Advisory Center ___ __ __ _ ___ / | /_\ / \___ __|__ / \ \___ __________________________________________________________ INFORMATION BULLETIN mod_ssl and Apache_SSL Modules Contain a Buffer Overflow [CERT Vulnerability Note VU#234971] March 6, 2002 00:00 GMT Number M-053 ______________________________________________________________________________ PROBLEM: There is a remotely exploitable buffer overflow in two modules that implement the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocol. PLATFORM: mod_ssl in all versions prior to 2.8.7-1.3.23. Apache-SSL in all version prior to 1.3.22+1.4.6. DAMAGE: An attacker may be able to execute arbitrary code on the system with the privileges of the ssl module. SOLUTION: Upgrade to mod_ssl 2.8.7 or Apache_SSL 1.3.22+1.46, or apply the patch provided by your vendor. ______________________________________________________________________________ VULNERABILITY The risk is MEDIUM. To exploit the overflow, the server must be ASSESSMENT: configured to allow client certificates, and an attacker must obtain a carefully crafted client certificate that has been signed by a Certificate Authority (CA) which is trusted by the server. ______________________________________________________________________________ LINKS: CIAC BULLETIN: http://www.ciac.org/ciac/bulletins/m-053.shtml ORIGINAL BULLETIN: http://www.kb.cert.org/vuls/id/234971 ______________________________________________________________________________ [***** Start CERT Vulnerability Note VU#234971 *****] CERT Vulnerability Note VU#234971 mod_ssl and Apache_SSL modules contain a buffer overflow in the implementation of the OpenSSL "i2d_SSL_SESSION" routine Overview There is a remotely exploitable buffer overflow in two modules that implement the Secure Sockets Layer (SSL) and TLS protocol. This can be used to execute arbitrary code. I. Description The Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols are used to provide a secure connection between a client and server for higher level protocols such as HTTP. Apache_SSL and mod_ssl are two modules for Apache that both call an OpenSSL routine i2d_SSL_SESSION() to help create an SSL/TLS session. This routine converts the SSL/TLS session data into a format that can be stored in the session cache. The OpenSSL d2i_SSL_SESSION.pod document states that the routine should be called to first determine the size of the buffer needed to store the session data, the appropriately sized buffer should then be allocated, and then the routine should be called again to convert the data. These two modules fail to follow this procedure, and use a statically defined buffer to store the results of the i2d_SSL_SESSION() routine. By establishing an SSL Session, with a large crafted client certificate signed by a trusted CA, an attacker may be able to execute arbitrary code. If the target server trusts multiple CA's, then the target server's risk receiving a malicious certificate is increased. Client certificates are generated when a Certificate Signature Request (CSR) is made of a Certificate Authority (CA), the CA signs the CSR with their server certificate and the resulting certificate is sent back to the client. Since some of the data contained in the CSR is entered by the person making the request it is possible to submit a large crafted CSR for signature, and have the CA sign it without suspicion. It should be noted that for testing purposes mod_ssl ships a static "snakeoil" CA server certificate. It is clearly stated that this certificate should not be used for production environments, and steps are given to dynamically generate a server certificate for the CA. If, however, a system uses this static "snakeoil" server certificate as their own CA signing certificate, then it is trivial for an attacker to craft, and sign their own client side certificate that would be accepted by the victim site as being signed by the trusted CA. The MD5 checksum for these static certificates from mod_ssl version 2.8.4 for Apache version 1.3.20 are as follows: 9bd1d1069c69fafed5a86ea931ae45f9 ca-bundle.crt b21689366a43829d83728b023b6d04b8 Makefile.crl 0de94cb2a39ed0fc158edd053b425255 Makefile.crt fbb7ae5d7e39607a39b1e36d30048683 README.CRL 84bfd413a53d6a8036311b57faa8f0c8 README.CRT a3351dacc96ebc615d986dfdb371c856 README.CSR 2284a70fae1cb3c1101494cff135f1f7 README.KEY 9a611f57078e624b672222197b8ff377 README.PRM b269a8269073c62bd83e6635d56ec11b server.crt 4ff42eeddd6571a29e0a7682d06137e4 server.csr ad5dc80749418c15c3d99962f00eb2b1 server.key 3c392576b27d8f79ab92eb39fce681f3 snakeoil-ca-dsa.crt 05cc51fdcc3c8ef6ed6a777f460e675a snakeoil-ca-dsa.key 3c9bf8ebd0586ce0633e7c6a85ed345a snakeoil-ca-dsa.prm e76c1653eb00e4c2168a9c590fcf4ed7 snakeoil-ca-rsa.crt a55527f1b3ad826052b8f6395d0da3e4 snakeoil-ca-rsa.key d1701e1c69a9867943ad61432f1f44b1 snakeoil-dsa.crt bc6e0ae4c628088f78e22c7287647b0a snakeoil-dsa.key 3c9bf8ebd0586ce0633e7c6a85ed345a snakeoil-dsa.prm 6c7a7d92f67c8dbd6ca57a30da7bc3bb snakeoil-rsa.crt ec09a963da45ee792d5eb284568894da snakeoil-rsa.key c98761828d8f030f973894f73e751e80 sslcfg.patch It appears that most of these test files have not changed since 1998-9 by the timestamp. II. Impact An attacker may be able to execute arbitrary code on the system with the privileges of the ssl module. III. Solution Upgrade to mod_ssl 2.8.7 or Apache_SSL 1.3.22+1.46, or apply the patch provided by your vendor. Systems Affected Vendor Status Date Updated Mod_ssl Vulnerable 1-Mar-2002 Apache-SSL Vulnerable 1-Mar-2002 Trustix Vulnerable 1-Mar-2002 Engarde Vulnerable 1-Mar-2002 Microsoft Not Vulnerable 4-Mar-2002 Conectiva Vulnerable 4-Mar-2002 References http://archives.neohapsis.com/archives/bugtraq/2002-02/0313.html http://www.apache-ssl.org/advisory-20020301.txt http://www.trustix.net/errata/misc/2002/TSL-2002-0034-apache.asc.txt http://www.linuxsecurity.com/advisories/other_advisory-1923.html http://www.apacheweek.com/issues/02-03-01.html#security Credit Ed Moyle discovered and analyzed this vulnerability. This document was written by Jason Rafail with assistance from Roman Danyliw, Sean Levy, and Jeff Havrilla. Other Information Date Public 02/27/2002 Date First Published 03/01/2002 05:52:19 PM Date Last Updated 03/04/2002 CERT Advisory CVE Name CAN-2002-0082 Metric 15.50 Document Revision 18 [***** End CERT Vulnerability Note VU#234971 *****] _______________________________________________________________________________ CIAC wishes to acknowledge the contributions of CERT/CC for the information contained in this bulletin. _______________________________________________________________________________ CIAC, the Computer Incident Advisory Center, 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) M-043: Hewlett-Packard Buffer Overflow in Telnet Server Vulnerability M-044: SQL Server Remote Data Source Function Contain Unchecked Buffers M-045: Microsoft Incorrect VBScript Handling in IE M-046: Red Hat "ncurses" Vulnerability M-047: Oracle PL/SQL EXTPROC Database Vulnerability M-048: Oracle 9iAS Default Configuration Vulnerability M-049: Multiple PHP Vulnerabilities M-050: Data Leak with Cisco Express Forwarding M-051: Microsoft XMLHTTP Control Vulnerability M-052: Microsoft Java Applet Can Redirect Browser Traffic