AddressSanitizer: heap-use-after-free on MediaTrackGraphImpl::GetInstance in add->isRemoved
A heap-use-after-free occurs in Firefox's MediaTrackGraphImpl::GetInstance when a canvas with a video source is repeatedly captured and the page is reloaded. An attacker could crash the browser tab by luring a user to a crafted page.
Originally disclosed on Mozilla
- Fixed in 6 days
- Paid in 8 days
- Disclosed after 6 days
Created attachment 9513658 testcase1.html
When run .canvas.captureStream() repeatedly to canvas that has media <video src> then call location.reload() after an interval, then after a seconds Firefox ASan will crash with SUMMARY: AddressSanitizer: heap-use-after-free /builds/worker/workspace/obj-build/dist/include/mozilla/HashTable.h:1182:35 in isRemoved
Tested on:
- Firefox Nightly 145.0a1 (2025-09-16) (64-bit)
- Firefox ESR 140.4.0esr (64-bit)
Steps to reproduce:
- Open Firefox ASan build
2 Visit attached testcase1.html 3. After a seconds, Firefox tab will crash with SUMMARY: AddressSanitizer: heap-use-after-free in isRemoved
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 media track graph teardown and canvas capture stream cleanup leaves a dangling reference that is later used.
Impact
A crafted page could crash the Firefox tab, causing a denial of service; the report does not claim code execution.
What the attacker needed
Victim visits a crafted page; Firefox ASan build (or affected version)
How it was found
- Open Firefox ASan build
- Visit attached testcase1.html
- After a few seconds, the tab crashes with a heap-use-after-free in isRemoved
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 use-after-free is a memory bug where a program keeps using a piece of memory after it has been freed, which can cause a crash or worse. Here, repeatedly capturing a canvas that plays a video and then reloading the page makes Firefox access freed memory, crashing the tab.
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.