Mozilla Firefox MediaCacheStream::NotifyDataReceived use-after-free vulnerability
A race condition in Firefox's buffered stream handling for media blobs lets a freed buffer be read again by the media cache thread. A crafted page could turn this use-after-free into arbitrary code execution.
Originally disclosed on Cisco Talos
A potential remote code execution vulnerability exists in the MediaCacheStream::NotifyDataReceived method of Mozilla Firefox 89.0.3 x64. A specially-crafted web page can cause a use-after-free vulnerability potentially resulting in a code execution.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
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 race between the media cache thread reading the buffered stream and the main thread tearing down the audio element, which frees the buffer without the reader holding a reference.
Impact
Could allow arbitrary code execution if the attacker can groom the heap, though the text only demonstrates a crash under AddressSanitizer.
What the attacker needed
Victim visits a malicious webpage; Firefox 89.0.3 x64
How it was found
- Create a media recorder and collect audio chunks in a blob.
- In the recorder's stop handler, build a blob URL and assign it to an audio element, then play it.
- Trigger removal or reload of the audio element so its decoder shuts down and the buffered stream is freed.
- The media cache thread then reads the freed buffer, producing the use-after-free.
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 a browser plays audio or video it keeps a temporary buffer of the data in memory. Here the page can make the browser throw that buffer away while another part of the browser is still reading from it, so it reads memory that has already been freed. Attackers who control what lands in that freed memory can sometimes hijack the browser.
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.