NTLM buffer overflow via integer overflow
libcurl contains a buffer overrun flaw in the NTLM authentication code. The internal function `Curl_ntlm_core_mk_ntlmv2_hash` sums up the lengths of the username + password (= SUM) and multiplies the sum by two (= SIZE) to figure out how large storage to allocate from the heap. The SUM value is subsequently used to iterate over the input and generate output into the storage buffer. On systems with a 32-bit `size_t`, the math to calculate SIZE triggers an integer overflow when the combined lengths of the username and password is larger than 2GB (2^31 bytes). This integer overflow usually causes a tiny buffer to actually get allocated instead of the intended huge one, making the use of that buffer end up in a buffer overrun.
02 / AFFECTED SOFTWARE
Affected packages
32 explicit affected versions
66 explicit affected versions
03 / CONNECTIONS
Connected vulnerabilities
04 / EVIDENCE
Source records
The NTLM authentication feature in curl and libcurl before 7.57.0 on 32-bit platforms allows attackers to cause a denial of service (integer overflow and resultant buffer overflow, and application crash) or possibly have unspecified other impact via vectors involving long user and password fields.
libcurl contains a buffer overrun flaw in the NTLM authentication code. The internal function `Curl_ntlm_core_mk_ntlmv2_hash` sums up the lengths of the username + password (= SUM) and multiplies the sum by two (= SIZE) to figure out how large storage to allocate from the heap. The SUM value is subsequently used to iterate over the input and generate output into the storage buffer. On systems with a 32-bit `size_t`, the math to calculate SIZE triggers an integer overflow when the combined lengths of the username and password is larger than 2GB (2^31 bytes). This integer overflow usually causes a tiny buffer to actually get allocated instead of the intended huge one, making the use of that buffer end up in a buffer overrun.
05 / REFERENCES
Further evidence
- http://security.cucumberlinux.com/security/details.php?id=161
- http://www.securityfocus.com/bid/101998
- http://www.securitytracker.com/id/1039896
- http://www.securitytracker.com/id/1040608
- https://access.redhat.com/errata/RHSA-2018:3558
- https://curl.haxx.se/docs/adv_2017-12e7.html
- https://security.gentoo.org/glsa/201712-04
- https://www.debian.org/security/2017/dsa-4051