==================================================================== CERT-Renater Note d'Information No. 2016/VULN333 _____________________________________________________________________ DATE : 15/09/2016 HARDWARE PLATFORM(S): / OPERATING SYSTEM(S): Systems running curl, libcurl versions 7.11.1 up to and including 7.50.2. ===================================================================== https://curl.haxx.se/docs/adv_20160914.html ____________________________________________________________________ curl escape and unescape integer overflows Project cURL Security Advisory, September 14, 2016 VULNERABILITY 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. INFO 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. AFFECTED VERSIONS 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! THE SOLUTION In version 7.50.3, these functions will deny negative string lengths from being used. A patch for CVE-2016-7167 is available. RECOMMENDATIONS We suggest you take one of the following actions immediately, in order of preference: 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() functions! TIME LINE 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 72674. libcurl 7.50.3 was released on September 14 2016, coordinated with the publication of this advisory. CREDITS Thanks to the Mitre CVE Assignment Team for reporting this to us. ========================================================== Serveur de référence du CERT-Renater https://services.renater.fr/ssi/ ========================================================== + CERT-RENATER | tel : 01-53-94-20-44 + + 23 - 25 Rue Daviel | fax : 01-53-94-20-41 + + 75013 Paris | email: cert@support.renater.fr + ==========================================================