CVE-2014-3613
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
Severity: Medium
AFFECTED VERSIONS
The IP address flaw has existed ever since libcurl started to support cookies.
- Affected versions: curl 4.0 to and including 7.37.1
- Not affected versions: curl >= 7.38.0
- Introduced-in: https://github.com/curl/curl/commit/ae1912cb0d494b48d
libcurl is used by many applications, but not always advertised as such!
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.
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.
TIMELINE
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
- Patched-by: Tim Ruehsen
Thanks a lot!