Skip to content
Memory corruption Advisory Advanced CVE-2026-7980

Use after free in WebAudio (CVE-2026-7980)

A use-after-free flaw in Blink's WebAudio module occurs when an AudioContext is in the kInterrupted state and an AudioNode is garbage collected, leaving a dangling pointer in the audio thread's rendering graph. An attacker could potentially exploit this to achieve remote code execution in the renderer process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 37 days

Project Fortify, an experimental security project, has identified the following potential security issue.

Overview: A potential Use-After-Free (UAF) vulnerability exists in Blink's WebAudio module when an AudioContext enters the kInterrupted state. During this state, garbage collection of an AudioNode can lead to the premature destruction of its AudioHandler and AudioNodeOutput, leaving a dangling pointer in the audio thread's rendering graph that can be exploited for RCE.

Affected files:

  • third_party/blink/renderer/modules/webaudio/audio_node.cc
  • third_party/blink/renderer/modules/webaudio/audio_summing_junction.h
  • third_party/blink/renderer/modules/webaudio/audio_node_input.cc
  • third_party/blink/renderer/modules/webaudio/audio_context.cc

Estimated timestamp from git blame: 2024-10-10

Description

A potential Use-After-Free (UAF) vulnerability has been identified in the Blink WebAudio module. The issue arises because AudioNode::Dispose() fails to account for the kInterrupted state when deciding whether to keep an AudioHandler alive for the audio rendering thread.

When an AudioContext is interrupted (e.g., by hiding an iframe with a restrictive media-playback-while-not-visible policy), the context stops pulling the audio graph and its state changes to kInterrupted. If an AudioNode is garbage collected while the context is in this state, its underlying AudioHandler and associated AudioNodeOutput objects are destroyed immediately. However, downstream AudioNodeInput objects maintain a rendering_outputs_ vector containing raw pointers to these outputs. By contesting the audio graph lock from the main thread, an attacker can prevent the audio thread from updating this vector, causing it to dereference the freed AudioNodeOutput upon resuming the context.

Root Cause Analysis

In third_party/blink/renderer/modules/webaudio/audio_node.cc, the Dispose() method manages the lifetime of the underlying AudioHandler:

C++
if (context()->IsPullingAudioGraph() ||
    context()->ContextState() == V8AudioContextState::Enum::kSuspended) {
    context()->GetDeferredTaskHandler().AddRenderingOrphanHandler(
        std::move(handler_));
}

When the context is in the kInterrupted state, IsPullingAudioGraph() returns false and the state is not kSuspended. Consequently, handler_ is not added to the rendering orphan list. When the AudioNode's destructor runs, handler_ is set to nullptr, dropping its refcount to 0.

This destroys the AudioHandler and its AudioNodeOutput (allocated via USING_FAST_MALLOC). Crucially, the audio thread's AudioSummingJunction::rendering_outputs_ (a Vector<AudioNodeOutput*>) still contains a raw pointer to this freed object. This vector is only updated when DeferredTaskHandler::HandleDeferredTasks() is called, which requires acquiring the graph lock.

Potential Exploitation Steps

(Note: These are suggested steps based on code analysis; a working Proof of Concept has not yet been executed by our tooling.)

  1. Setup: An attacker creates an AudioContext and connects an AudioNode (e.g., a GainNode) to the destination.
  2. Trigger Interruption: The attacker hides the iframe containing the context, triggering StartContextInterruption(). The state becomes kInterrupted and allow_pulling_audio_graph_ becomes false.
  3. Garbage Collection: The attacker removes JavaScript references to the GainNode and forces a garbage collection. AudioNode::Dispose() runs but fails to orphan the handler. The AudioNodeOutput is freed.
  4. Heap Spray: The attacker sprays the PartitionAlloc heap to reclaim the freed AudioNodeOutput memory. They overwrite the handler_ field (a raw_ref<AudioHandler>) to point to a fake, attacker-controlled AudioHandler object with a fake vtable. (MiraclePtr/BRP checks pass because the raw_ref pointer value itself was overwritten to point to a valid, attacker-controlled allocation).
  5. Resumption and Race: The attacker makes the iframe visible again, which resumes the context and allows the audio thread to pull the graph. Concurrently, the attacker runs a tight loop on the main thread calling connect()/disconnect() on dummy nodes to heavily contest the graph lock.
  6. Execution: The audio thread's TryLock() in HandlePreRenderTasks() fails due to the lock contention. It skips HandleDeferredTasks(), leaving rendering_outputs_ un-updated. The audio thread then dereferences the dangling pointer in rendering_outputs_ and calls output->Pull(). This invokes Handler().ProcessIfNecessary(), which performs a virtual method call using the attacker's fake vtable, leading to Remote Code Execution (RCE) in the Renderer process.

Suggested Fix

Update the condition in AudioNode::Dispose() to explicitly include the kInterrupted state, ensuring the handler is properly orphaned if the context might be resumed later.

C++
if (context()->IsPullingAudioGraph() ||
    context()->ContextState() == V8AudioContextState::Enum::kSuspended ||
    context()->ContextState() == V8AudioContextState::Enum::kInterrupted) {
    context()->GetDeferredTaskHandler().AddRenderingOrphanHandler(
        std::move(handler_));
}

Evaluated with Chrome root at commit: a9cbf6e8b275fe4147435aa905f3b7f5a656f5f0


Results from 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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 AudioNode::Dispose() method does not consider the kInterrupted state when deciding to keep the AudioHandler alive, so the handler and its output are destroyed while the audio thread still holds a raw pointer to them.

Impact

An attacker could potentially achieve remote code execution in the renderer process, though a working proof of concept has not been executed.

What the attacker needed

Attacker can run JavaScript in a page; ability to hide and show an iframe; ability to force garbage collection; ability to spray heap memory

The fix

The condition in AudioNode::Dispose() should be updated to explicitly include the kInterrupted state, ensuring the handler is properly orphaned if the context might be resumed later.

How it was found

  1. Create an AudioContext and connect an AudioNode (e.g., a GainNode) to the destination.
  2. Hide the iframe containing the context to trigger interruption, changing the state to kInterrupted.
  3. Remove JavaScript references to the GainNode and force garbage collection, causing the AudioNodeOutput to be freed.
  4. Spray the heap to reclaim the freed memory and overwrite the handler_ field with a fake AudioHandler.
  5. Make the iframe visible again to resume the context and contest the graph lock from the main thread.
  6. The audio thread dereferences the dangling pointer and calls a virtual method, leading to code execution.

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 web page plays audio, the browser uses objects to manage the sound. A bug causes one of these objects to be deleted too early while the audio system still tries to use it, which can crash the browser or let an attacker run their own code. This is called a use-after-free because the program uses memory after it has been freed.

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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.