curl / Docs / curl CVEs / Secure Transport certificate check bypass

CVE-2014-8151

Secure Transport certificate check bypass

Project curl Security Advisory, January 8th 2015 - Permalink

VULNERABILITY

libcurl stores TLS Session IDs in its associated Session ID cache when it connects to TLS servers. In subsequent connects it re-uses the entry in the cache to resume the TLS connection faster than when doing a full TLS handshake. The actual implementation for the Session ID caching varies depending on the underlying TLS backend.

libcurl allows applications to switch off certificate verification in two different ways - using CURLOPT_SSL_VERIFYHOST and CURLOPT_SSL_VERIFYPEER.

When an application connected to a TLS server with certificate verification disabled, it would store the Session ID in the cache and if then a subsequent connection was made against the same host and port number, it would re-use the former session and thanks to the the re-used session from the cache, it would skip the certificate check and wrongly accept any bad certificate that could be presented.

The problem was that the "key" used for caching Session IDs did not take the certificate check status into account.

This problem is specific to libcurl built to use the Secure Transport backend for TLS, so it can only affect Mac and iPhone based applications.

INFO

This flaw can also affect the curl command line tool if a similar operation series is made with that.

The Common Vulnerabilities and Exposures (CVE) project has assigned the name CVE-2014-8151 to this issue.

CWE-297: Improper Validation of Certificate with Host Mismatch

Severity: Medium

AFFECTED VERSIONS

libcurl is used by many applications, but not always advertised as such!

SOLUTION

libcurl 7.40.0 makes sure that the certificate check status is used in the key set for the Session ID and thus it cannot re-use IDs between checked and unchecked TLS connections.

RECOMMENDATIONS

We suggest you take one of the following actions immediately, in order of preference:

A - Upgrade to curl and libcurl 7.40.0

B - Apply the patch and rebuild libcurl

C - Avoid disabling the server certificate checks when using TLS

TIMELINE

It was first reported to the curl project on November 26 2014.

We contacted Apple Product Security on December 17. We contacted distros@openwall on December 28.

libcurl 7.40.0 was released on January 8th 2015, coordinated with the publication of this advisory.

CREDITS

Thanks a lot!