Race condition in WebAudio (CVE-2026-106213)
A race condition in WebAudio's MediaElementAudioSourceHandler may allow cross-origin audio samples to be captured because the origin-taint flag is not reset when the media element's source changes. An attacker could stall the main thread during media loading to capture raw PCM frames from a cross-origin resource.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 4 months
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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential race condition in WebAudio's MediaElementAudioSourceHandler may allow the initial decoded PCM samples of a cross-origin audio stream to be exfiltrated. Because the handler's security state is not reset when the HTMLMediaElement source changes, a stale origin-taint flag can be used to render audio from a new cross-origin resource. An attacker could potentially exploit this by stalling the main thread during media loading to capture the raw audio frames.
Affected files:
third_party/blink/renderer/modules/webaudio/media_element_audio_source_handler.ccthird_party/blink/renderer/modules/webaudio/media_element_audio_source_node.hthird_party/blink/renderer/platform/media/web_audio_source_provider_impl.ccthird_party/blink/renderer/core/html/media/html_media_element.cc
Estimated timestamp from git blame: 2018-06-05
Potential Cross-Origin Audio Leak via Stale is_origin_tainted_ Cache in WebAudio
Analysis
In WebAudio, the MediaElementAudioSourceHandler (owned by MediaElementAudioSourceNode) caches the origin-taint status in is_origin_tainted_ (default false). This flag is only updated inside SetFormat() on the main thread.
When an HTMLMediaElement's source changes from same-origin to cross-origin:
- The existing
MediaElementAudioSourceHandleris kept alive and reused for the lifetime of the WebAudio node. - During the source change,
HTMLMediaElementinvokes the provider client'sOnCurrentSrcChanged()callback. However,OnCurrentSrcChangedinMediaElementAudioSourceNodeis an empty stub, meaningis_origin_tainted_is not reset and remains stale (false). - A new
WebAudioSourceProviderImplis created for the new resource. Its format update callback (set_format_cb_) is bound to the main thread viaBindPostTaskToCurrentDefault. - When the background media thread initializes and starts decoding the new resource, it calls
WebAudioSourceProviderImpl::Initialize(), which posts anOnSetFormattask to the main thread. It then immediately starts playing. - During this window, if the real-time audio thread executes
MediaElementAudioSourceHandler::Process(), it pulls raw PCM frames from the new player. Sinceis_origin_tainted_is still stale (false) and the background taint check (tee_filter_->is_tainted()) has not yet been updated on the stalled main thread, the cross-origin PCM frames are processed normally and can be captured.
Note: Because our analysis is static and our tooling does not yet have the ability to run code, these are potential steps and vulnerabilities that have not been dynamically executed or confirmed via a working proof-of-concept.
Potential Attack Scenario
- An attacker plays a same-origin audio file to prime the WebAudio graph so that
is_origin_tainted_is cached asfalse. - The attacker sets the
srcof the<audio>element to a sensitive cross-origin target. - Upon the
'loadstart'event, the attacker blocks the renderer's main thread with a busy loop (e.g., 200ms). - The background network and media threads load and decode the cross-origin audio in parallel. Because the main thread is stalled, the posted tasks to update the format and mark the source as tainted are delayed.
- The real-time WebAudio thread continues to run, pulling the raw cross-origin PCM frames and rendering them into the attacker's downstream WebAudio nodes (such as an
AudioWorkletNode) due to the stale security flags.
Suggested Fix
To prevent the leak, the handler's security and format state should be reset to a safe default whenever the media element's source changes. This can be achieved by implementing OnCurrentSrcChanged in MediaElementAudioSourceNode:
void MediaElementAudioSourceNode::OnCurrentSrcChanged(const KURL& current_src) {
// Reset format variables and default to tainted/silent state to avoid leaks
GetMediaElementAudioSourceHandler().ResetCurrentSourceState();
}
Inside MediaElementAudioSourceHandler, we should define ResetCurrentSourceState to safely reset the cached parameters under a lock:
void MediaElementAudioSourceHandler::ResetCurrentSourceState() {
MediaElementAudioSourceHandlerLocker locker(*this);
source_sample_rate_ = 0;
source_number_of_channels_ = 0;
is_origin_tainted_ = true; // Safe default until proven same-origin
}
Evaluated with Chrome root at commit: d8b226a3be7c9c1ac9240c09e14698866c82e4ac
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
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 origin-taint flag (is_origin_tainted_) is cached and not reset when the media element's source changes, so a stale 'not tainted' state allows cross-origin audio to be processed.
Impact
An attacker could potentially capture raw audio samples from a cross-origin resource, but the report notes this is a static analysis and has not been dynamically confirmed.
What the attacker needed
Attacker controls a web page; victim visits the attacker's page; cross-origin audio resource exists
The fix
The handler's security and format state should be reset to a safe default whenever the media element's source changes, by implementing OnCurrentSrcChanged to reset the cached parameters under a lock.
How it was found
- Play a same-origin audio file to prime the WebAudio graph so that is_origin_tainted_ is cached as false.
- Set the src of the <audio> element to a sensitive cross-origin target.
- Upon the 'loadstart' event, block the renderer's main thread with a busy loop.
- The background network and media threads load and decode the cross-origin audio in parallel while the main thread is stalled.
- The real-time WebAudio thread continues to run, pulling raw cross-origin PCM frames and rendering them into downstream WebAudio nodes.
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.
WebAudio lets a web page process audio from an <audio> element. Normally, if the audio comes from another website, the browser blocks access to the raw sound data to protect privacy. This report suggests that by quickly switching the audio source and freezing the page at the right moment, an attacker might bypass that block and read the other site's audio.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.