use-after-free in FilePickerShownCallback
The FilePickerShownCallback code assumed only one callback would be requested at a time, but Done() destroys the parent object, so calling Done() again after the first one causes a use-after-free. An attacker with a compromised content process could trigger this crash by opening and closing several file picker windows.
Originally disclosed on Mozilla
- Fixed in 13 days
- Paid in 13 days
- Disclosed after 13 days
Created attachment 9346877
ASAN.txt
|FilePickerShownCallback| is requested when a File Picker window open[1]. It isn’t considered several |FilePickerShownCallback| are requested at a time. And |Done()| will destroy |mFilePickerParent|[2]. This leads to use-after-free when another |Done()| is called after a |Done()|
[1]: https://searchfox.org/mozilla-central/source/dom/ipc/FilePickerParent.cpp#239
[2]: https://searchfox.org/mozilla-central/source/dom/ipc/FilePickerParent.cpp#174
REPRODUCE
1. apply *patch.diff
2. visit index.html
3. close serveral File Picker windows
*: 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 FilePickerShownCallback would be active at a time, so a second Done() call operated on an already-destroyed mFilePickerParent.
Impact
A compromised content process could trigger a use-after-free crash in the browser process, which may be exploitable for code execution.
What the attacker needed
Compromised content process; attacker-controlled web page
How it was found
- Apply the provided patch that emulates a compromised content process
- Visit the index.html test page
- Close several File Picker windows
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 file picker is the dialog that lets you choose a file to upload. The browser code that handles this dialog frees its memory when the dialog finishes, but it did not expect the dialog to finish twice. If it does, the code uses memory that has already been freed, which can crash the browser and, in the worst case, 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.