OOB read in libuv
An out-of-bounds read occurs in libuv's uv__idna_toascii() when converting strings to ASCII, because the pointer p is read and incremented without checking if it exceeds the buffer end pe. This can lead to information disclosure or crashes, and the function can be triggered via uv_getaddrinfo().
Originally disclosed on HackerOne
- Triaged in 32 hours
- Fixed in 36 days
- Paid in 41 days
- Disclosed after 40 days
Summary:
The pointer p is read and increased without checking whether it is beyond pe, with the latter holding a pointer to the end of the buffer. This can lead to information disclosures or crashes. This function can be triggered via uv_getaddrinfo(). nodejs seems to use libuv and is possibly affected by this as well.
Description: An out-of-bound read can occur when uv__idna_toascii() is used to convert strings to ASCII. The pointer p is read and increased without checking whether it is beyond pe, with the latter holding a pointer to the end of the buffer. This can lead to information disclosures or crashes. This function can be triggered via uv_getaddrinfo(). nodejs seems to use libuv and is possibly affected by this as well.
Steps To Reproduce:
i attached a testcase and the ad-hoc fuzzer I used to identify the issues. If you need further help reproducing, please let me know.
static unsigned uv__utf8_decode1_slow(const char** p,
const char* pe,
unsigned a) {
unsigned b;
unsigned c;
unsigned d;
unsigned min;
if (a > 0xF7)
return -1;
switch (*p - pe) {
default:
if (a > 0xEF) {
if (p + 3 > pe)
return -1;
min = 0x10000;
a = a & 7;
b = (unsigned char) *(*p)++; // OOB READ
c = (unsigned char) *(*p)++; // OOB READ
d = (unsigned char) *(*p)++; // OOB READ
break;
}
/* Fall through. */
Impact: [add why this issue matters]
Possiblity to crash the process when untrusted hostnames are passed to uv__getaddrinfo()
Supporting Material/References:
Misc
This issue was found during an audit of Cure53 for ExpressVPN but ExpressVPN is not affected by the issue. I reported it to the libuv project, whose maintainers suggested that i report it to nodejs directly as well.
Impact
An oob read that does not seem to be abused to leak data, but possibly read to a guarded page which segfaults the process.
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
Root cause
Likely the code fails to check that the pointer p stays within the buffer bounds before reading and incrementing it.
Impact
An out-of-bounds read that does not seem to be abused to leak data, but possibly read to a guarded page which segfaults the process.
What the attacker needed
Untrusted hostname passed to uv_getaddrinfo()
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.
A program reads past the end of a memory buffer when converting a hostname to ASCII. This can crash the program or leak memory contents. The bug is in a library called libuv, which Node.js uses.
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.