curl / Docs / Security Problems / cookie leak with IP address as domain

cookie leak with IP address as domain

Project curl Security Advisory, September 10th 2014 Permalink

VULNERABILITY

By not detecting and rejecting domain names for partial literal IP addresses properly when parsing received HTTP cookies, libcurl can be fooled to both sending cookies to wrong sites and into allowing arbitrary sites to set cookies for others.

For this problem to trigger, the client application must use the numerical IP address in the URL to access the site and the site must send back cookies to the site using domain= and a partial IP address.

Since libcurl wrongly approaches the IP address like it was a normal domain name, a site at IP address 192.168.0.1 can set cookies for anything ending with .168.0.1 thus fooling libcurl to send them also to for example 129.168.0.1.

The flaw requires dots to be present in the IP address, which restricts the flaw to IPv4 literal addresses or IPv6 addresses using the somewhat unusual "dotted-quad" style: ::ffff:192.0.2.128.

This is not believed to be done by typical sites as this is not supported by clients that adhere to the rules of the RFC 6265, and many sites are written to explicitly use their own specific named domain when sending cookies.

INFO

Cookie parsing and use is opt-in by applications and is not enabled by default.

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

CWE-201: Information Exposure Through Sent Data

AFFECTED VERSIONS

The IP address flaw has existed ever since libcurl started to support cookies.

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

THE SOLUTION

libcurl 7.38.0 makes sure that when connected to a site specified with a literal IP address, only exact matches are considered for cookies.

A patch for this problem is available

RECOMMENDATIONS

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

A - Upgrade to curl and libcurl 7.38.0

B - Apply the patch and rebuild libcurl

C - Avoid using cookies in your application if you ever use URLs involving literal IP addresses.

TIME LINE

It was reported to the curl project on August 15th 2014. We contacted distros@openwall on September 1st.

libcurl 7.38.0 was released on September 10th 2014, coordinated with the publication of this advisory.

CREDITS

Reported by Tim Ruehsen. Patch written by Tim Ruehsen.

Thanks a lot!