[32-bit] Access violation on nsExpatDriver::HandleError -> AppendErrorPointer
A 32-bit Firefox crash occurs when parsing large HTML as XML via DOMParser, due to an out-of-bounds read in nsExpatDriver::HandleError. An attacker could cause a denial of service by crafting a page that triggers this crash.
Originally disclosed on Mozilla
- Fixed in 30 days
- Paid in 36 days
- Disclosed after 30 days
Created attachment 9325353 testcase-0x2.html
When running new DOMParser().parseFromString(document.documentElement.outerHTML, 'application/xml') on large HTML continuously in loop, Firefox 32-bit able to crash with AV_READ on nsExpatDriver::HandleError() at changeable address that depends on DOM size or the length of HTML.
When running the testcase on Firefox single process ./mach run --disable-e10s then attach gdb debugger, the crash is shown at following code:
954 // Last character will be '^'.
955 int32_t last = aColNumber - 1;
956 int32_t i;
957 uint32_t minuses = 0;
958 for (i = 0; i < last; ++i) {
→ 959 if (aSourceLine[i] == '\t') {
960 // Since this uses |white-space: pre;| a tab stop equals 8 spaces.
961 uint32_t add = 8 - (minuses % 8);
962 aSourceString.AppendASCII("--------", add);
963 minuses += add;
964 } else {
It looks like Firefox tried to accessing out-of-bounds element on aSourceLine array. In case the aSourceLine array address is 0x25ce0008 then the crash address is 0x25cff000.
Tested on:
- Firefox Nightly 113.0a1 (2023-03-27) (32-bit) on Windows 11
- Firefox 111.0.1 (32-bit) on Windows 11
- Firefox ESR 102.9.0esr (32-bit) on Windows 11
Steps to reproduce:
- Visit attached testcase-0x2.html
- After a few seconds, the Firefox tab crashes
If Firefox tab doesn't crash after a while, try close the tab and try again.
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 an out-of-bounds read in nsExpatDriver::HandleError when iterating over aSourceLine without proper bounds checking.
Impact
A crafted webpage could cause a denial of service by crashing the Firefox tab on 32-bit systems.
What the attacker needed
32-bit Firefox; Victim visits a malicious page
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.
This report describes a crash in Firefox when it tries to show an error message for malformed XML. The crash happens because the code reads past the end of a memory buffer, which can make the browser tab close unexpectedly. An attacker could use this to disrupt a user's browsing.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.