search menu icon-carat-right cmu-wordmark

CERT Coordination Center

mod_ssl and Apache_SSL modules contain a buffer overflow in the implementation of the OpenSSL "i2d_SSL_SESSION" routine

Vulnerability Note VU#234971

Original Release Date: 2002-03-01 | Last Revised: 2002-04-22

Overview

There is a remotely exploitable buffer overflow in two modules that implement the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocol. This can be used to execute arbitrary code.

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. Then the appropriately sized buffer should be allocated and finally 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 CAs, then the target server's risk of 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 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

According to the timestamps, it appears that most of these test files have not changed since 1998-1999.

Impact

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.47, or apply the patch provided by your vendor.

Vendor Information

234971
 

View all 12 vendors View less vendors


CVSS Metrics

Group Score Vector
Base
Temporal
Environmental

References

Acknowledgements

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

CVE IDs: CVE-2002-0082
Severity Metric: 15.50
Date Public: 2002-02-27
Date First Published: 2002-03-01
Date Last Updated: 2002-04-22 20:44 UTC
Document Revision: 26

Sponsored by CISA.