Bug 1136154 (CVE-2014-3613)

Summary: CVE-2014-3613 curl: incorrect handling of IP addresses in cookie domain
Product: [Other] Security Response Reporter: Murray McAllister <mmcallis>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: acathrow, anemec, bazulay, bmcclain, cfergeau, dblechte, gklein, idith, iheim, kdudka, lsurette, michal.skrivanek, rbalakri, security-response-team, slawomir, srevivo, szidek, thoger, wmealing, ykaul
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: curl 7.38.0 Doc Type: Bug Fix
Doc Text:
It was found that the libcurl library did not correctly handle partial literal IP addresses when parsing received HTTP cookies. An attacker able to trick a user into connecting to a malicious server could use this flaw to set the user's cookie to a crafted domain, making other cookie-related issues easier to exploit.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-11 09:02:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1139453, 1139454, 1140036, 1140037, 1140038, 1175776, 1215062    
Bug Blocks: 1136155, 1193283, 1210268    
Attachments:
Description Flags
patch from upstream none

Description Murray McAllister 2014-09-02 04:15:01 UTC
Daniel Stenberg reported the following vulnerability in cURL that could cause libcurl-based HTTP clients to leak cookie information:

IP address as domain problem

   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
   127.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 explictly use their own specific named domain when sending cookies.

Versions 7.1 up to and including 7.37.1 are affected.

Information about how to enable cookies is available from http://curl.haxx.se/docs/http-cookies.html

Acknowledgements:

Red Hat would like to thank the cURL project for reporting this issue. Upstream acknowledges Tim Ruehsen as the original reporter.

Comment 2 Murray McAllister 2014-09-02 04:16:28 UTC
Created attachment 933581 [details]
patch from upstream

Comment 7 Tomas Hoger 2014-09-08 18:21:41 UTC
This issue can affect applications using curl if they enabled cookie support and are used to access HTTP/HTTPS servers using IP address rather than host name.  To take advantage of the problem, attacker needs to trick victim into connecting to their malicious server using its IP address.  The IP of the malicious server must have the last two or three octets of it match relevant octets of a non-malicious server IP victim normally connects to (i.e. using example from comment 0, if victim normally connects to 192.168.0.1, attack's malicious server must use an IP ending with 168.0.1 or 0.1).  In such case, attacker's server can send cookies with crafted 'domain' attribute that will be sent to the target server.

This can provide an attacker with a way to exploit other cookie handling bugs on the target server (e.g. session fixation issues, or other issues related to improper sanitization of cookie values).

It does not seem this issue can lead to leak of cookies in any reasonable use case.  A non-malicious server would have to incorrectly set 'domain' attributes on cookies it returns to risk their expose to other servers.

Comment 8 Tomas Hoger 2014-09-08 18:23:22 UTC
Statement:

This issue affects the versions of curl as shipped with Red Hat Enterprise Linux 5 and is not planned to be corrected in future updates.

Inktank Ceph Enterprise 1.1 and 1.2 receives only qualified Important and Critical impact security fixes. This issue has been rated as having Moderate security impact and is not currently planned to be addressed in future updates. For additional information, refer to the Inktank Ceph Enterprise Support Matrix:
http://www.inktank.com/enterprise/support/

Comment 17 Murray McAllister 2014-09-10 08:28:44 UTC
This issue is public now.

External References:

http://curl.haxx.se/docs/adv_20140910A.html

Comment 18 Murray McAllister 2014-09-10 08:34:37 UTC
Created curl tracking bugs for this issue:

Affects: fedora-all [bug 1140036]

Comment 19 Murray McAllister 2014-09-10 08:34:41 UTC
Created mingw-curl tracking bugs for this issue:

Affects: fedora-all [bug 1140037]
Affects: epel-7 [bug 1140038]

Comment 20 Fedora Update System 2014-09-14 03:27:26 UTC
curl-7.32.0-13.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 21 Fedora Update System 2014-09-23 04:26:20 UTC
curl-7.37.0-7.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 22 Fedora Update System 2014-10-08 19:03:42 UTC
curl-7.29.0-23.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 30 errata-xmlrpc 2015-07-22 05:43:35 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 6

Via RHSA-2015:1254 https://rhn.redhat.com/errata/RHSA-2015-1254.html

Comment 32 errata-xmlrpc 2015-11-19 07:06:38 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2015:2159 https://rhn.redhat.com/errata/RHSA-2015-2159.html