Missing buffer size check in NEXT_PARAMS
A macro used to parse PathOps data in the graphics rendering code reads from a buffer without first checking its size. An attacker who can supply crafted PathOps data could trigger an out-of-bounds read, as demonstrated by an AddressSanitizer crash.
Originally disclosed on Mozilla
- Fixed in 32 days
- Paid in 34 days
- Disclosed after 32 days
Created attachment 9346862
ASAN.txt
|PathOps| is used by graphics rendering. In certain situations, |StreamToSink()|, |TransformedCopy()| and |AsCircle()| are called. They all use |NEXT_PARAMS| MACRO to parse |PathOps|[1],[2],[3]. There is no buffer size check before reading. It leads to out-of-bound Read[4].
[1]: https://searchfox.org/mozilla-central/source/gfx/2d/PathRecording.cpp#18
[2]: https://searchfox.org/mozilla-central/source/gfx/2d/PathRecording.cpp#66
[3]: https://searchfox.org/mozilla-central/source/gfx/2d/PathRecording.cpp#115
[4]: https://searchfox.org/mozilla-central/source/gfx/2d/PathRecording.cpp#14
REPRODUCE
Operating System: Windows
1.apply *patch.diff
2.visit index.html
*: Patch to emulate a compromised content process.
Crash State: see asan file
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 NEXT_PARAMS macro advances and reads from the PathOps buffer without verifying that enough bytes remain.
Impact
An attacker able to control PathOps data could cause an out-of-bounds read, leading to a crash and potentially disclosure of adjacent memory.
What the attacker needed
Crafted PathOps data; compromised content process (per repro)
How it was found
- Apply the provided patch to emulate a compromised content process.
- Open the index.html page to trigger the crash.
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.
Some drawing code reads a list of instructions from a buffer. It trusts that the buffer is long enough and starts reading without checking the length first. If the buffer is shorter than expected, the program reads past the end of it, which is called an out-of-bounds read and can crash the program or leak memory contents.
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.