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

Use after free in WebRTC (CVE-2026-79187)

A use-after-free and data race can occur when replacing a WebRTC track if the parent iframe is detached during the operation, causing a track adapter to be destroyed on the wrong thread. An attacker could potentially corrupt memory and achieve remote code execution, though no working proof of concept is provided.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 2 months

Flapjack, 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 Use-After-Free and data race can occur when replacing a WebRTC track if the parent iframe is detached during the operation. This detachment kills the main thread task runner, causing a cross-thread task to fail and destroy a track adapter on the wrong thread. Concurrent modification of the track's sink vector on the main thread leads to a Use-After-Free memmove on the signaling thread.

Affected files:

  • third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender_impl.cc
  • third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.cc
  • third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.cc
  • third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc

Estimated timestamp from git blame: 2018-01-08

Summary

A Use-After-Free (UAF) and data race vulnerability exists in WebRTC's track replacement logic. If an attacker detaches the iframe hosting an RTCPeerConnection exactly while a replaceTrack operation is communicating with the WebRTC signaling thread, the callback task intended for the main thread is rejected because the task runner has shut down. The rejection causes the callback closure and its captured AdapterRef to be destroyed synchronously on the signaling thread. This triggers a destruction chain that modifies the MediaStreamVideoTrack's sink vectors without locks. A concurrent interaction with the track from the main thread can cause the vector to reallocate, resulting in the signaling thread performing a UAF memmove on a freed backing buffer.

Potential Exploitation Steps

Note: These steps trace the theoretical path through the codebase. We do not have a working Proof of Concept.

  1. Setup: An attacker creates an iframe and initializes an RTCPeerConnection inside it, acquiring a local video MediaStreamTrack. A reference to this track is leaked to the parent window.
  2. Trigger replaceTrack: The attacker calls RTCRtpSender.replaceTrack(track).
  3. Task Queued: On the main thread, RTCRtpSenderImpl::ReplaceTrack synchronously creates a WebRtcMediaStreamTrackAdapter and an AdapterRef. It posts a task (ReplaceTrackOnSignalingThread) to the WebRTC signaling thread, capturing the AdapterRef in the closure.
  4. Iframe Detachment: The attacker uses the parent window to immediately detach the iframe. This destroys the iframe's execution context, shutting down its main_task_runner_.
  5. Task Execution and Failure: The signaling thread executes ReplaceTrackOnSignalingThread. It finishes its work and attempts to post ReplaceTrackCallback back to the main thread via PostCrossThreadTask, moving the AdapterRef into the new closure.
  6. Closure Destruction: Because main_task_runner_ is dead, PostCrossThreadTask returns false. The OnceClosure is destroyed immediately on the caller thread (the signaling thread).
  7. Unsafe Destruction Chain: The closure's destruction destroys the AdapterRef. ~AdapterRef observes it is the final reference and calls adapter->Dispose().
  8. Thread-Hostile Access: The disposal chain continues on the signaling thread: DisposeLocalVideoTrack() -> ~MediaStreamVideoWebRtcSink() -> DisconnectFromTrack() -> MediaStreamVideoTrack::RemoveSink(). Note that release builds bypass the DCHECK_CALLED_ON_VALID_THREAD macro.
  9. The Memory Operation: RemoveSink() calls WTF::Vector::erase() on sinks_. Because the vector holds pointers, this translates to a memmove on the signaling thread to shift elements down.
  10. The Race and UAF: Concurrently, the attacker uses the parent window to interact with the leaked track reference (e.g., calling clone()). This triggers sinks_.push_back() on the main thread. If this causes the vector to ExpandCapacity(), the old backing buffer is freed by the main thread exactly while the signaling thread is executing a memmove on it.

By carefully timing the reallocation and spraying replacement objects (like an ArrayBuffer backing store), the attacker can cause the signaling thread to shift the contents of the newly allocated object by 8 bytes, corrupting pointers or lengths and leading to arbitrary read/write and Remote Code Execution.

Suggested Fix

Ensure that the destruction of WebRTC adapters and the resulting disconnection from Blink tracks always occurs on the main thread.

In WebRtcMediaStreamTrackAdapterMap::AdapterRef::~AdapterRef(), if the current thread is not the main thread, the call to removed_adapter->Dispose() should be posted to the main thread (using a task runner that is guaranteed to outlive the ExecutionContext, or by ensuring thread-safe disposal). Alternatively, ensure MediaStreamVideoTrack operations use proper locking, though keeping Blink object modification strictly on the main thread is generally preferred.

Evaluated with Chrome root at commit: 2155cb00003ec35716a76ed3246eae995f87b7ff


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.

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 destruction of a WebRTC track adapter can happen on the signaling thread instead of the main thread, leading to unsynchronised access to a shared vector.

Impact

An attacker could potentially corrupt memory and achieve arbitrary read/write and remote code execution, but no working exploit is demonstrated.

What the attacker needed

Ability to run JavaScript in a browser; victim visits a malicious page; timing control over iframe detachment

The fix

Ensure that the destruction of WebRTC adapters and the resulting disconnection from Blink tracks always occurs on the main thread.

How it was found

  1. Create an iframe with an RTCPeerConnection and leak a reference to a local video track to the parent window.
  2. Call replaceTrack on the sender, which posts a task to the signaling thread.
  3. Detach the iframe from the parent window, shutting down its main task runner.
  4. The signaling thread executes the task and fails to post the callback back, destroying the closure and adapter on the signaling thread.
  5. The adapter disposal calls RemoveSink on the track, performing a memmove on the signaling thread.
  6. Concurrently, the parent window interacts with the leaked track (e.g., calling clone), causing a vector reallocation and a use-after-free.

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.

This report describes a memory safety bug in a web browser's real-time communication feature. When a web page is closed at just the wrong moment, the browser can free memory that is still being used, which might let an attacker run their own code. The report is theoretical and no working exploit is shown.

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.