Bug 1213347 (CVE-2015-3145)

Summary: CVE-2015-3145 curl: cookie parser out of boundary memory access
Product: [Other] Security Response Reporter: Vasyl Kaigorodov <vkaigoro>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: acathrow, alonbl, bazulay, bmcclain, ceph-eng-bugs, cfergeau, dblechte, ecohen, erik-fedora, gklein, idith, iheim, kdudka, lsurette, michal.skrivanek, paul, rbalakri, rh-spice-bugs, security-response-team, yeylon
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: curl 7.42.0 Doc Type: Bug Fix
Doc Text:
It was discovered that libcurl did not properly process cookies with a specially crafted "path" element. If an application using libcurl connected to a malicious HTTP server sending specially crafted "Set-Cookies" headers, this could lead to an out-of-bounds read, and possibly cause that application to crash.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-24 11:17:27 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: 1214182, 1214795, 1214796    
Bug Blocks: 1213355    

Description Vasyl Kaigorodov 2015-04-20 11:03:59 UTC
libcurl supports HTTP "cookies" as documented in RFC 6265. Together with each
individual cookie there are several different properties, but for this
vulnerability we focus on the associated "path" element. It tells information
about for which path on a given host the cookies is valid.

The internal libcurl function called `sanitize_cookie_path()` that cleans up
the path element as given to it from a remote site or when read from a file,
did not properly validate the input. If given a path that consisted of a
single double-quote, libcurl would index a newly allocated memory area with
index -1 and assign a zero to it, thus destroying heap memory it wasn't
supposed to.

At best, this gets unnoticed but can also lead to a crash or worse. We have
not researched further what kind of malicious actions that potentially this
could be used for.

Applications have to explicitly enable cookie parsing in libcurl for this
problem to trigger, and if not enabled libcurl will not hit this problem.

We are not aware of any exploits of this flaw.

Affected versions: from libcurl 7.31.0 to and including 7.41.0

Acknowledgements:

Red Hat would like to thank Daniel Stenberg (curl upstream) for reporting this issue. Upstream acknowledges Hanno Böck as the original reporter.

Comment 1 Martin Prpič 2015-04-22 07:55:08 UTC
External References:

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

Comment 2 Martin Prpič 2015-04-22 07:56:52 UTC
Created curl tracking bugs for this issue:

Affects: fedora-all [bug 1214182]

Comment 4 Stefan Cornelius 2015-04-23 14:32:21 UTC
Created mingw-curl tracking bugs for this issue:

Affects: fedora-all [bug 1214795]
Affects: epel-7 [bug 1214796]

Comment 5 Stefan Cornelius 2015-04-23 14:38:52 UTC
Patch:
http://curl.haxx.se/CVE-2015-3145.patch

Comment 6 Huzaifa S. Sidhpurwala 2015-04-24 08:41:24 UTC
Statement:

Not vulnerable. This issue does not affect the version of curl as shipped with Red Hat Enterprise Linux 5, 6 and 7.

Comment 8 Fedora Update System 2015-04-26 12:42:45 UTC
curl-7.40.0-3.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2015-04-28 13:01:25 UTC
curl-7.32.0-20.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2015-05-02 18:11:34 UTC
curl-7.37.0-14.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.