AddressSanitizer: heap-buffer-overflow in TextContainsLineBreakerWhiteSpace layout/generic/nsTextFrame.cpp
A crafted HTML page triggers a heap-buffer-overflow in Firefox's text layout code when checking for line-breaker white space, causing the tab to crash. Resizing or moving the window can also produce use-after-poison crashes with varying stacks.
Originally disclosed on Mozilla
- Fixed in 5 days
- Paid in 52 days
- Disclosed after 5 days
Created attachment 9627055 testcase.html
After visiting the testcase.html in web server e.g. python -m http.server, the Firefox tab crash with AddressSanitizer: heap-buffer-overflow in TextContainsLineBreakerWhiteSpace layout/generic/nsTextFrame.cpp.
When resizing or moving the Firefox window, it can also crash with use-after-poison with various different crash stack.
When running the testcase with mozregression asan build, it able to crash after commit Bug 2054166 - Force reflow floats when the last column is reflowed with an unconstrained block-size
Steps to reproduce
- Download attached testcase.html
- Run
python -m http.serverto serve the testcase - Open Firefox ASan
- Visit http://127.0.0.1:8000/testcase.html
- Tab crashed with heap-buffer-overflow
If it still doesn't crash on the first try, try resizing the Firefox window while the testcase tab is open.
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 the text line-breaking check, introduced or exposed by a change to float reflow when the last column has an unconstrained block-size.
Impact
A malicious page could crash the browser tab and, through window resizing, trigger use-after-poison memory corruption that may be exploitable.
What the attacker needed
Victim opens a crafted HTML page; AddressSanitizer build to observe the crash
How it was found
- Download the attached testcase file.
- Serve it locally with a simple HTTP server.
- Open an AddressSanitizer build of Firefox.
- Visit the testcase URL in the browser.
- Observe the tab crash with the heap-buffer-overflow report.
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.
Firefox lays out text on screen using code that reads characters from a buffer. A bug in that code lets it read past the end of the buffer, which a memory checker (AddressSanitizer) flags as a heap-buffer-overflow. The result is a crashed tab, and in some cases memory corruption that could potentially be exploited.
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.