Access violation on BuildTextRunsScanner::ScanFrame at layout/generic/nsTextFrame.cpp
A crafted page that calls setRangeText on a textarea with a long string, then repeatedly scrolls and spawns workers inside queueMicroTask, causes Firefox to crash with an access violation in the text layout code. An attacker could use this to crash a victim's browser tab, though the report does not show code execution.
Originally disclosed on Mozilla
- Fixed in 7 months
- Paid in 8 months
- Disclosed after 7 months
Created attachment 9327382 testcase-setrangetext1.html
After run setRangeText on textarea with long string, then run window.scrollByPages and new worker repeatedly on queueMicroTask, Firefox tab able to crash on BuildTextRunsScanner::ScanFrame(nsIFrame*) at layout/generic/nsTextFrame.cpp, the crash address able to change e.g. 0xeb4ff006, 0x73982014, 0x73997014, 0x9fbff006, and more.
Tested on:
- Firefox Nightly 113.0a1 (2023-04-06) (32-bit)
- Firefox 111.0.1 (32-bit)
- Firefox ESR 102.9.0esr (32-bit)
Steps to reproduce:
- Open Firefox 32-bit
- Visit attached testcase-setrangetext1.html
- Analyze the crash dump
If Firefox crash at EXCEPTION_BREAKPOINT, try again until it crash at ACCESS_VIOLATION_READ
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 a memory-safety flaw in the text layout scanner, where a frame or text run is used after the layout state has been invalidated by the rapid setRangeText, scrolling and worker activity.
Impact
The browser tab can crash with an access violation, and the crash address varies between runs, indicating memory corruption rather than a clean abort.
What the attacker needed
32-bit Firefox build; victim opens a crafted page
How it was found
- Open a 32-bit build of Firefox.
- Load the attached test case page.
- Examine the resulting crash dump.
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 web page can ask the browser to change the text inside a text box and to scroll the page. Doing these things in a particular rapid pattern confuses Firefox's code that lays out text, and the browser crashes. A crash is a denial of service: the tab stops working, but the report does not show an attacker gaining control of the machine.
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.