double free in curl_maprintf
The libcurl API function called `curl_maprintf()` can be tricked into doing a double free due to an unsafe `size_t` multiplication, on systems using 32-bit `size_t` variables. The function is also used internally in numerous situations. The function doubles an allocated memory area with realloc() and allows the size to wrap and become zero and when doing so realloc() returns NULL *and* frees the memory - in contrary to normal realloc() fails where it only returns NULL - causing libcurl to free the memory *again* in the error path. Systems with 64-bit versions of the `size_t` type are not affected by this issue. This behavior can be triggered using the publicly exposed function.
02 / AFFECTED SOFTWARE
Affected packages
139 explicit affected versions
281 explicit affected versions
03 / CONNECTIONS
Connected vulnerabilities
04 / EVIDENCE
Source records
The libcurl API function called `curl_maprintf()` before version 7.51.0 can be tricked into doing a double-free due to an unsafe `size_t` multiplication, on systems using 32 bit `size_t` variables.
The libcurl API function called `curl_maprintf()` can be tricked into doing a double free due to an unsafe `size_t` multiplication, on systems using 32-bit `size_t` variables. The function is also used internally in numerous situations. The function doubles an allocated memory area with realloc() and allows the size to wrap and become zero and when doing so realloc() returns NULL *and* frees the memory - in contrary to normal realloc() fails where it only returns NULL - causing libcurl to free the memory *again* in the error path. Systems with 64-bit versions of the `size_t` type are not affected by this issue. This behavior can be triggered using the publicly exposed function.
05 / REFERENCES
Further evidence
- http://www.oracle.com/technetwork/security-advisory/cpuoct2018-4428296.html
- http://www.securityfocus.com/bid/94098
- http://www.securitytracker.com/id/1037192
- https://access.redhat.com/errata/RHSA-2018:2486
- https://access.redhat.com/errata/RHSA-2018:3558
- https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2016-8618
- https://curl.haxx.se/docs/adv_20161102D.html
- https://security.gentoo.org/glsa/201701-47
- https://www.tenable.com/security/tns-2016-21