Use after free in WebAudio (CVE-2026-9952)
A suspected race between the main-thread garbage collector and the audio rendering thread could free an audio buffer while the audio thread is still copying frames into it, producing a use-after-free write. The report claims an attacker could shape the written float data and, by winning the race, corrupt a reallocated object, potentially leading to code execution in the renderer.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 40 days
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential cross-thread race condition between the main thread garbage collector and the audio rendering thread can cause a heap use-after-free write in AudioPushFifo. A pre-finalizer may destroy the underlying audio buffer while the background audio thread is actively writing to it.
Affected files:
media/base/audio_push_fifo.ccthird_party/blink/renderer/platform/mediastream/media_stream_source.ccthird_party/blink/renderer/platform/mediastream/webaudio_media_stream_source.ccthird_party/blink/renderer/platform/mediastream/media_stream_audio_source.ccthird_party/blink/renderer/modules/webaudio/media_stream_audio_destination_handler.cc
Estimated timestamp from git blame: 2026-01-23
Summary
A potential heap use-after-free (UAF) vulnerability exists in the WebAudio to MediaStream pipeline. A lack of proper synchronization during garbage collection (GC) allows the MediaStreamSource pre-finalizer to destroy a WebAudioMediaStreamSource and its associated AudioPushFifo buffer while the audio rendering thread is concurrently writing audio frames into that buffer. This results in an out-of-bounds/Use-After-Free write of attacker-controlled audio float data into freed heap memory.
Technical Details
- When a
MediaStreamAudioDestinationNodeis created, it allocates aWebAudioMediaStreamSourceand then wraps it in a garbage-collectedMediaStreamSource. - Due to Blink's Oilpan LIFO (reverse-registration) execution order for pre-finalizers,
MediaStreamSource::Disposewill execute beforeMediaStreamAudioDestinationNode::Disposeduring a GC sweep. - The audio thread processes data via
MediaStreamAudioDestinationHandler::Process, which acquiresconsumer_lock_and forwards audio toWebAudioMediaStreamSource::ConsumeAudio. - Inside
ConsumeAudio, the audio data is pushed into anAudioPushFifo. The audio thread extracts stack-localbase::spanreferences pointing directly to theAudioBus's underlying memory (base::AlignedHeapArray<float>) and begins a copy loop (CopyPartialFramesTo). - If the
AudioContextAsyncStateTransitionsfeature is enabled, theAudioContextmay still be in thekSuspendedstate immediately after creation, causingMediaStreamAudioDestinationNode::HasPendingActivity()to returnfalse. This makes the node and itsMediaStreamSourceunexpectedly eligible for garbage collection, even though the background render thread is actively processing the graph. - The GC executes
MediaStreamSource::Dispose()on the main thread, which directly deletes theWebAudioMediaStreamSource(and consequently frees theAudioBus's float array) without acquiringconsumer_lock_. - The audio thread, completely unaware of the destruction, continues its copy loop, writing attacker-controlled float values into the now-freed
AlignedHeapArraymemory.
MiraclePtr (BackupRefPtr) does not protect against this vulnerability because the audio thread accesses the buffer memory via raw base::span slices that were retrieved before the object's destruction, bypassing the BRP quarantine mechanisms for the AudioBus object itself.
Suggested Exploit Steps
(Note: These are potential steps to trigger the vulnerability, as our automated tooling cannot run code to verify a proof-of-concept.)
- Create an
AudioContextwithAudioContextAsyncStateTransitionsenabled. - Create an
AudioBufferSourceNodepopulated with a craftedAudioBuffercontaining malicious pointers and forged vtables encoded as float values. - Create a
MediaStreamAudioDestinationNodeand connect the source node to it. - Call
start()on the source node to initiate audio processing. - Immediately remove all Javascript references to the destination node and trigger garbage collection before the
AudioContextfully transitions to thekRunningstate. - The GC will free the
AudioBusmemory while the audio thread is concurrently copying the crafted float payload into it. By allocating a victim object into the freed block during the race window, the UAF write will corrupt the victim object, potentially leading to arbitrary Remote Code Execution (RCE) in the renderer.
Suggested Fix
There are multiple potential ways to address this issue:
- Prevent Premature GC: Modify
MediaStreamAudioDestinationNode::HasPendingActivity()to returntruewhenever an async state transition is pending. This prevents the nodes from being collected while the audio thread might be starting up. - Ensure Safe Destruction Order: The audio thread relies on
MediaStreamAudioDestinationNode::Dispose()to acquireconsumer_lock_and nullifydestination_consumer_. Ensure this cleanup runs before the underlyingMediaStreamSourcedestroys theWebAudioMediaStreamSource. - Use Smart Pointers/Thread-Safe Destruction: Manage the lifecycle of
WebAudioMediaStreamSourceacross threads usingscoped_refptrinstead of relying entirely on the GC pre-finalizer order.
Evaluated with Chrome root at commit: 2b349e31cb87959d6a548625986c65e0a2d2e380
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
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 garbage collector's pre-finalizer destroys the audio source without taking the consumer lock, so the audio thread keeps writing through stale spans into freed memory.
Impact
If the race is won, the write could corrupt a reallocated object and potentially lead to arbitrary code execution in the renderer, though the report notes the steps are unverified.
What the attacker needed
Feature flag enabled; attacker-supplied audio buffer; win a timing race
The fix
The report suggests making the node report pending activity while a state transition is outstanding, ordering cleanup so the lock is taken before the source is destroyed, or managing the source's lifetime with reference counting across threads.
How it was found
- Create an audio context with the async state transition feature enabled.
- Create a buffer source node filled with a crafted audio buffer.
- Create a media stream destination node and connect the source to it.
- Start the source node so audio processing begins.
- Drop all references to the destination node and force garbage collection before the context reaches the running state.
- The freed buffer is written to during the race, corrupting any object allocated into that space.
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 happens when a program frees a chunk of memory but keeps using it, so new data placed there can be overwritten or misread. Here the browser's cleanup code is said to free an audio buffer on one thread while a background audio thread is still writing sound samples into it. The report is unverified and comes from automated tooling, so it may be a false positive.
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.