use-after-free in ColorPickerShownCallback
A colour picker callback object could be destroyed while other callbacks for the same picker were still pending, so a second completion call touched freed memory. An attacker with a compromised content process could trigger a use-after-free crash, and potentially worse, in the browser process.
Originally disclosed on Mozilla
- Fixed in 13 days
- Paid in 13 days
- Disclosed after 13 days
Created attachment 9346872
ASAN.txt
|ColorPickerShownCallback| is requested when a Color Picker window open[1]. It isn’t considered several |ColorPickerShownCallbacks| are requested at a time. And |Done()| will destroy |mColorPickerParent|[2]. This leads to use-after-free when another |Done()| is called after a |Done()|
[1]: https://searchfox.org/mozilla-central/source/dom/ipc/ColorPickerParent.cpp#66
[2]: https://searchfox.org/mozilla-central/source/dom/ipc/ColorPickerParent.cpp#30
REPRODUCE
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 code assumed only one ColorPickerShownCallback existed per picker, so Done() destroyed the shared parent while other callbacks still referenced it.
Impact
A compromised content process could cause a use-after-free in the browser process, leading to a crash and potentially memory corruption.
What the attacker needed
Compromised content process; attacker-supplied patch to emulate it
How it was found
- Apply the provided patch that emulates a compromised content process
- Visit the test page that opens the colour picker
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.
When you open a colour picker, the browser keeps a small helper object to know when the picker is finished. The code assumed only one helper existed at a time, but several could be created, and finishing one threw the shared object away while others still pointed at it. Using something after it has been thrown away is called a use-after-free and can crash the browser or let an attacker run their own code.
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.