libcurl Integer Overflow in Escape Functions May Let Users Execute Arbitrary Code on the Target System
SecurityTracker Alert ID: 1036813|
SecurityTracker URL: http://securitytracker.com/id/1036813
(Links to External Site)
Date: Sep 15 2016
Execution of arbitrary code via local system, Execution of arbitrary code via network, User access via local system, User access via network|
Fix Available: Yes Vendor Confirmed: Yes |
Version(s): libcurl 7.11.1 - 7.50.2|
A vulnerability was reported in libcurl. A user can execute arbitrary code on the target system.|
A user can supply a specially crafted length parameter value to certain libcurl functions to trigger an integer overflow and execute arbitrary code on the target system.
The curl_escape(), curl_easy_escape(), curl_unescape(), and curl_easy_unescape() functions are affected.
The specific impact depends on the application using libcurl.
The curl command line tool is not affected.
The Mitre CVE Assignment Team reported this vulnerability.
A user can execute arbitrary code on the target system.|
The vendor has issued a fix (7.50.3).|
The vendor advisory is available at:
Vendor URL: curl.haxx.se/docs/adv_20160914.html (Links to External Site)
|Underlying OS: Linux (Any), UNIX (Any), Windows (Any)|
This archive entry has one or more follow-up message(s) listed below.|
Source Message Contents
Subject: [oss-security] [SECURITY VULNERABILITY] curl escape and unescape integer overflows|
curl escape and unescape integer overflows
Project cURL Security Advisory, September 14, 2016 -
The four libcurl functions `curl_escape()`, `curl_easy_escape()`,
`curl_unescape` and `curl_easy_unescape` perform string URL percent escaping
and unescaping. They accept custom string length inputs in signed integer
arguments. (The functions having names without "easy" being the deprecated
versions of the others.)
The provided string length arguments were not properly checked and due to
arithmetic in the functions, passing in the length 0xffffffff (2^32-1 or
`UINT_MAX` or even just -1) would end up causing an allocation of zero bytes
of heap memory that curl would attempt to write gigabytes of data into.
The use of 'int' for this input type in the API is of course unwise but has
remained so in order to maintain the API over the years.
We are not aware of any exploit of this flaw.
This flaw does not affect the curl command line tool.
The Common Vulnerabilities and Exposures (CVE) project has assigned the name
CVE-2016-7167 to this issue.
This flaw exists in the following libcurl versions.
- Affected versions: libcurl 7.11.1 to and including 7.50.2
- Not affected versions: libcurl < 7.11.1 and libcurl >= 7.50.3
libcurl is used by many applications, but not always advertised as such!
In version 7.50.3, these functions will deny negative string lengths from
A [patch for CVE-2016-7167](https://curl.haxx.se/CVE-2016-7167.patch) is
We suggest you take one of the following actions immediately, in order of
A - Upgrade curl and libcurl to version 7.50.3
B - Apply the patch to your version and rebuild
C - Make sure you don't pass in string lengths larger than `INT_MAX`
(typically 2^31) or negative values to the `curl_easy_(un)escape()`
It was first reported to the curl project on September 8 by the Mitre CVE
Assignment Team based on the discussions in [PHP bug report
libcurl 7.50.3 was released on September 14 2016, coordinated with the
publication of this advisory.
Thanks to the Mitre CVE Assignment Team for reporting this to us.