Use after free in WebRTC (CVE-2026-15121)
A race condition in the WebRTC video decoder adapter means that if initialisation times out, the adapter is destroyed while tasks holding raw pointers to its members are still queued. Those tasks later run and call virtual methods on freed memory, which an attacker could potentially turn into code execution in the renderer.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 25 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A race condition exists in RTCVideoDecoderAdapter where initialization can time out, causing the adapter to be destroyed while initialization tasks remain pending. Because WTF::CrossThreadUnretained is used to capture raw pointers, subsequent asynchronous failure callbacks bypass MiraclePtr and access dangling pointers. This results in UAF virtual method calls and memory corruption, potentially leading to renderer Remote Code Execution (RCE).
Affected files:
third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_adapter.ccthird_party/blink/renderer/platform/peerconnection/rtc_video_decoder_adapter.h
Estimated timestamp from git blame: 2025-11-20
Summary
A race condition in RTCVideoDecoderAdapter::InitializeSync can lead to a heap use-after-free (UAF) in the renderer process. When initialization of the video decoder takes longer than the hardcoded 10-second timeout, InitializeSync returns false, causing the caller to destroy the RTCVideoDecoderAdapter object. However, initialization tasks previously posted to the media thread may still be pending and hold raw pointers to the adapter's members and the underlying media::VideoDecoder. When these tasks eventually run, they access freed memory.
Vulnerability Details
In RTCVideoDecoderAdapter::InitializeSync (third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_adapter.cc:607), several members are captured via CrossThreadUnretained and passed to a task on the media thread:
auto init_cb = CrossThreadBindOnce(
&FinishWait, CrossThreadUnretained(async_init_waiter_.get()),
CrossThreadUnretained(&async_init_result_));
if (PostCrossThreadTask(
*media_task_runner_.get(), FROM_HERE,
CrossThreadBindOnce(&RTCVideoDecoderAdapter::Impl::Initialize,
weak_impl_, config, std::move(init_cb), start_time,
CrossThreadUnretained(&decoder_type_)))) {
if (!async_init_waiter_->TimedWait(base::Seconds(10))) {
// ...
return false; // Timeout occurs here
}
Because WTF::CrossThreadUnretained is used, these pointers decay to raw C++ pointers, completely bypassing MiraclePtr (BackupRefPtr) protection.
The UAF race condition occurs as follows:
- Task A Enqueued:
InitializeSyncpostsImpl::Initialize(Task A) to the media thread and blocks viaTimedWait(base::Seconds(10)). - Timeout: If the media thread is heavily backlogged, Task A does not execute within 10 seconds.
InitializeSyncreturnsfalse. - Destruction & Task B Enqueued: The caller (e.g.,
RTCVideoDecoderAdapter::Create) destroys the adapter. The destructor callsRelease(), which postsimpl.reset()(Task B) to the media thread queue and waits for it. The queue is now[Task A, Task B]. - Task A Executes & Enqueues Task C: The media thread eventually processes Task A. It instantiates a
media::VideoDecoderand calls itsInitialize()method, passing a lambda callback that bindsCrossThreadUnretained(video_decoder_.get()). If initialization fails synchronously (e.g., bad config), decoders likeMediaCodecVideoDecoderusebase::BindPostTaskToCurrentDefaultto post the completion callback asynchronously. This appends Task C to the queue, resulting in[Task B, Task C]. - Task B Executes: The media thread runs Task B (
impl.reset()). This destroys theImplobject, which in turn frees themedia::VideoDecoder. Task B signalsRelease()to complete, allowing theRTCVideoDecoderAdapterto be freed. - Task C Executes (UAF): The media thread runs Task C, the completion lambda. The lambda executes
video_decoder->GetDecoderType(), which is a UAF virtual method call on the freedVideoDecoderobject. - Further UAFs: The lambda continues to write to the dangling
decoder_type_pointer. Finally,FinishWaitcallswaiter->Signal()on the danglingasync_init_waiter_pointer.WaitableEvent::Signal()loops over an internal list of waiters and calls the pure virtual methodFire(), providing a secondary avenue for a UAF virtual method call.
Impact
This is a heap use-after-free vulnerability in the renderer process. An attacker could potentially exploit this race condition to achieve arbitrary Remote Code Execution (RCE) by reallocating the freed media::VideoDecoder or WaitableEvent memory with controlled data before Task C executes. Hijacking the virtual method calls (GetDecoderType() or Fire()) provides direct control over the instruction pointer.
Triggering the issue (Potential Steps)
Note: These are suggested steps; our tooling agent does not yet run code to provide a functional PoC.
- A malicious website initiates a WebRTC video stream.
- The attacker uses intensive JavaScript operations to intentionally spam and backlog the renderer's media task runner.
- This forces the 10-second
TimedWaitinInitializeSyncto expire while initialization tasks are still pending. - The attacker provides an invalid video configuration to force the synchronous failure path in the underlying decoder, ensuring Task C is appended after Task B.
- The attacker uses standard JS heap manipulation techniques to reclaim the freed memory between the execution of Task B and Task C.
Suggested Fix
Remove the use of WTF::CrossThreadUnretained in RTCVideoDecoderAdapter::InitializeSync. Instead of capturing raw pointers to member variables, the completion callback should be bound to a base::WeakPtr of the adapter, or the RTCVideoDecoderAdapter should safely manage the lifetime of its initialization state such that pending callbacks are explicitly cancelled or ignored if the adapter is destroyed.
Evaluated with Chrome root at commit: 65b3256311f3ab6fb9870eaa522de7e6dd2663bb
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 initialisation callback captures raw pointers via CrossThreadUnretained instead of a weak reference, so pending tasks are not cancelled or invalidated when the adapter is destroyed after a timeout.
Impact
An attacker could potentially achieve arbitrary remote code execution in the renderer by reclaiming the freed memory and hijacking the virtual method calls, though the report notes no working proof of concept has been run.
What the attacker needed
Victim visits a malicious page; WebRTC video stream initiated; media thread backlogged for 10 seconds; invalid video configuration supplied
The fix
The use of CrossThreadUnretained should be removed so the callback is bound to a weak pointer or the pending callbacks are cancelled when the adapter is destroyed.
How it was found
- A malicious website starts a WebRTC video stream.
- The attacker floods the renderer's media task runner with heavy JavaScript work.
- The 10-second wait in initialisation expires while tasks are still pending.
- An invalid video configuration forces the decoder's synchronous failure path so the completion task is queued after the release task.
- The attacker tries to reclaim the freed memory before the completion task runs.
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 program frees a chunk of memory but keeps a pointer to it and later uses that pointer, this is called a use-after-free. Here a timeout causes the video decoder object to be deleted while background work that still refers to it is waiting in a queue, so that work later touches memory that no longer belongs to it. If an attacker can control what is placed in that freed memory, they may be able to redirect the program's execution.
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.