libcurl: SMTP end-of-response out-of-bounds read - CVE-2019-3823
libcurl's SMTP response parser could read past the end of a heap buffer when the response was not NUL-terminated and contained no terminating character. An attacker could trigger an out-of-bounds read, though the read data is not returned to the caller.
- Disclosed after 21 months
libcurl contains a heap out-of-bounds read in the code handling the
end-of-response for SMTP.
If the buffer passed to `smtp_endofresp()` isn't NUL terminated and contains
no character ending the parsed number, and `len` is set to 5, then the
`strtol()` call reads beyond the allocated buffer. The read contents will not
be returned to the caller.
The issue was reported to the project on 18 January 2019. A patch was sent to me on 19 January 2019. curl 7.64.0 was released on 6 January 2019.
https://curl.haxx.se/docs/CVE-2019-3823.html
Impact
If the buffer passed to smtp_endofresp() isn't NUL terminated and contains no character ending the parsed number, and len is set to 5, then the strtol() call reads beyond the allocated buffer.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could cause an out-of-bounds read, but the read contents are not returned to the caller.
What the attacker needed
SMTP response without NUL terminator; response contains no terminating character; len set to 5
The fix
A patch was sent on 19 January 2019.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The number-reading function kept looking past the end of the buffer. This is a bug because it can crash the program, but the extra data was not returned to the caller.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.