curl escape and unescape integer overflows
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 -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.
02 / AFFECTED SOFTWARE
Affected packages
138 explicit affected versions
82 explicit affected versions
03 / CONNECTIONS
Connected vulnerabilities
04 / EVIDENCE
Source records
Multiple integer overflows in the (1) curl_escape, (2) curl_easy_escape, (3) curl_unescape, and (4) curl_easy_unescape functions in libcurl before 7.50.3 allow attackers to have unspecified impact via a string of length 0xffffffff, which triggers a heap-based buffer overflow.
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 -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.
05 / REFERENCES
Further evidence
- http://www.oracle.com/technetwork/security-advisory/cpuoct2018-4428296.html
- http://www.securityfocus.com/bid/92975
- http://www.securitytracker.com/id/1036813
- http://www.slackware.com/security/viewer.php?l=slackware-security&y=2016&m=slackware-security.538632
- https://access.redhat.com/errata/RHSA-2017:2016
- https://access.redhat.com/errata/RHSA-2018:2486
- https://access.redhat.com/errata/RHSA-2018:3558
- https://curl.haxx.se/docs/adv_20160914.html
- https://lists.debian.org/debian-lts-announce/2018/11/msg00005.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/B3IU2FRXQNU6UJIQT4NGLWWTP2GJQXO7/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LTH54DFOS4TSYPG5XKJDGAG4XPAR4T7M/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ZMRWVISG7VUCYRMF23A2UHMYD72VQWAK/
- https://security.gentoo.org/glsa/201701-47