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

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

A race condition between the WebRTC encoder thread and the GPU task runner allows unsynchronised access to a member variable, leading to a heap use-after-free. An attacker could potentially exploit this to achieve arbitrary code execution in the renderer process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 16 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 race condition between the WebRTC encoder thread and the GPU task runner in RTCVideoEncoder allows concurrent access to simulcast_to_svc_converter_ without locking. If an attacker triggers an encoder reconfiguration while input frames are queued, a task ordering race can result in a Heap Use-After-Free during a virtual method call. This vulnerability could lead to arbitrary code execution within the renderer process.

Affected files:

  • third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc

Estimated timestamp from git blame: 2024-09-20

Summary

A potential race condition in RTCVideoEncoder::Impl::SetSimulcastToSvcConverter can lead to a heap use-after-free (UAF) in the renderer process. The vulnerability occurs due to unsynchronized cross-thread access to the simulcast_to_svc_converter_ member between the WebRTC encoder thread and the GPU task runner during encoder reconfiguration.

Root Cause Analysis

In third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc, the simulcast_to_svc_converter_ member is accessed by two distinct threads without synchronization:

  1. Read: The GPU task runner reads it inside RTCVideoEncoder::Impl::EncodeOneFrame and makes virtual method calls on its owned objects.
  2. Write: The WebRTC encoder thread move-assigns it directly inside RTCVideoEncoder::Impl::SetSimulcastToSvcConverter during InitEncode.

A race window opens when an RTCPeerConnection video track is reconfigured (e.g., via applyConstraints()) while the encoder has frames waiting in pending_frames_.

During reconfiguration, the WebRTC thread calls DrainEncoderAndUpdateFrameSize, posting an Impl::Drain task to the GPU task runner and blocking on drain_waiter.Wait(). Impl::Drain issues a Mojo Flush command to the hardware encoder.

As the hardware encoder finishes previous Encode calls, it releases its references to the input media::VideoFrame objects. The destruction observer for these frames (RTCVideoEncoder::Impl::InputBufferReleased) is posted back to the GPU task runner via base::BindPostTaskToCurrentDefault(). Because it is posted, it lands at the end of the GPU task runner's queue.

When the Flush operation completes, Mojo directly executes the RTCVideoEncoder::Impl::DrainCompleted callback. This means DrainCompleted is executed by the GPU task runner before the asynchronously posted InputBufferReleased task.

DrainCompleted signals drain_waiter, immediately unblocking the WebRTC thread. The WebRTC thread then returns to InitEncode and executes impl_->SetSimulcastToSvcConverter(std::move(...)), destroying the old SimulcastToSvcConverter object.

Concurrently, the GPU task runner finishes DrainCompleted and executes InputBufferReleased. It finds frames in pending_frames_, calls EncodeOneFrame, and attempts to execute virtual methods on the ScalableVideoController objects owned by the SimulcastToSvcConverter that the WebRTC thread is currently destroying.

Impact

This race results in a heap Use-After-Free targeting std::vector<LayerState> elements and the std::unique_ptr<webrtc::ScalableVideoController> objects they contain. Because the UAF targets an object with virtual methods (ScalableVideoController::OnEncodeDone), an attacker capable of manipulating the heap could potentially hijack the virtual call and achieve arbitrary code execution in the renderer process.

This code resides partially in the WebRTC codebase (third_party/webrtc/modules/video_coding/svc/), where std::unique_ptr is used instead of base::raw_ptr. As such, this vulnerability is not mitigated by MiraclePtr (BackupRefPtr).

Potential Trigger Path

Please note: These are theoretical steps; our automated tooling has not verified this with an executable Proof-of-Concept.

  1. A page creates an RTCPeerConnection using VP9 on Windows with a hardware encoder supporting SVC scalability.
  2. The page provides frames to the encoder faster than it can process them, causing the pending_frames_ queue to fill and hardware input buffers to become exhausted.
  3. The page triggers a same-layer-count reconfiguration (e.g., track.applyConstraints()) that allows the RTCVideoEncoder::Impl instance to be reused.
  4. During the drain/flush sequence, the race between the InputBufferReleased task and the WebRTC thread's SetSimulcastToSvcConverter call occurs, triggering the UAF.

Suggested Fix

Ensure that all access to simulcast_to_svc_converter_ is synchronized.

One approach is to use the existing lock_ mutex inside RTCVideoEncoder::Impl to protect read/write access to simulcast_to_svc_converter_. Alternatively, ensure that SetSimulcastToSvcConverter is executed strictly on the GPU task runner (via PostCrossThreadTask), just like other state modifications in RTCVideoEncoder::Impl.

Evaluated with Chrome root at commit: 7353d249d9cacf9c7218e1d7b8a39cf39c72d646


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.

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 simulcast_to_svc_converter_ member is accessed by two threads without synchronisation, and the ordering of tasks on the GPU task runner allows the object to be destroyed while still in use.

Impact

An attacker could potentially hijack a virtual call and achieve arbitrary code execution in the renderer process, though the report notes the steps are theoretical and not verified with an executable proof-of-concept.

What the attacker needed

Windows with hardware encoder supporting SVC; VP9 codec in use; Page can create RTCPeerConnection; Page can trigger encoder reconfiguration

The fix

Access to simulcast_to_svc_converter_ should be synchronised, either by using the existing lock_ mutex or by ensuring SetSimulcastToSvcConverter runs only on the GPU task runner.

How it was found

  1. A page creates an RTCPeerConnection using VP9 on Windows with a hardware encoder supporting SVC scalability.
  2. The page provides frames to the encoder faster than it can process them, causing the pending_frames_ queue to fill and hardware input buffers to become exhausted.
  3. The page triggers a same-layer-count reconfiguration (e.g., track.applyConstraints()) that allows the RTCVideoEncoder::Impl instance to be reused.
  4. During the drain/flush sequence, the race between the InputBufferReleased task and the WebRTC thread's SetSimulcastToSvcConverter call occurs, triggering the UAF.

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 memory but then keeps using it, like deleting a file and still trying to open it. Here, two parts of the browser (the encoder thread and the GPU task runner) access the same object without coordination, so one frees it while the other is still using it. This could let an attacker run their own code inside the browser.

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.