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

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

A race condition in the WebRTC statistics-collecting encoder wrapper lets callbacks from a hardware encoder and a software encoder run at the same time, so one thread can free a histogram object while another is still writing to it. An attacker could turn this use-after-free into a constrained arbitrary memory increment and potentially achieve code execution inside the renderer sandbox.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 5 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 without the Chrome Security team.

Overview: A potential race condition exists in blink::StatsCollectingEncoder when processing mixed hardware and software simulcast streams, leading to a Use-After-Free (UAF). Concurrent callbacks from different threads can cause one thread to free a LinearHistogram while another thread is actively writing to it. If successfully exploited, this could provide an arbitrary memory increment primitive, potentially leading to Remote Code Execution within the renderer sandbox.

Affected files:

  • third_party/blink/renderer/platform/peerconnection/stats_collecting_encoder.cc
  • third_party/blink/renderer/platform/peerconnection/stats_collector.cc
  • third_party/blink/renderer/platform/peerconnection/stats_collector.h
  • third_party/webrtc/media/engine/simulcast_encoder_adapter.cc
  • third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc

Estimated timestamp from git blame: 2026-02-18

Summary

A race condition in blink::StatsCollectingEncoder allows for a potential Use-After-Free (UAF) in the Renderer process. The vulnerability occurs because OnEncodedImage callbacks from different encoding layers in a simulcast configuration can run concurrently on different threads, leading to unsynchronized access and destruction of StatsCollector data members.

Technical Details

blink::StatsCollectingEncoder acts as a wrapper around webrtc::SimulcastEncoderAdapter to collect encoding performance statistics. When a WebRTC connection is configured for simulcast with layers of vastly different resolutions, the adapter may initialize a mixed hardware/software encoding setup (e.g., a hardware encoder for the high-resolution layer and a software fallback for the low-resolution layer).

Callbacks from these sub-encoders happen on different threads:

  • Software encoders invoke the OnEncodedImage callback synchronously on the WebRTC encoder task queue.
  • Hardware encoders deliver the callback asynchronously on the gpu_task_runner thread.

SimulcastEncoderAdapter::OnEncodedImage drops its internal pending_frames_mutex_ before forwarding the callback to StatsCollectingEncoder. As a result, StatsCollectingEncoder::OnEncodedImage and subsequently StatsCollector::AddProcessingTime can be executed concurrently by both threads without synchronization.

Inside StatsCollector::AddProcessingTime (third_party/blink/renderer/platform/peerconnection/stats_collector.cc), a race condition occurs:

  1. Thread A (e.g., SW layer) enters AddProcessingTime, passes the configuration check (pixel_size == current_stats_key_.pixel_size), and prepares to call processing_time_ms_histogram_->Add(). It is then preempted.
  2. Thread B (e.g., HW layer) enters concurrently. Because it has a different pixel_size, it takes the else branch and calls StartStatsCollection().
  3. StartStatsCollection() executes processing_time_ms_histogram_ = std::make_unique<LinearHistogram>(...). This destroys the existing LinearHistogram object, freeing its backing memory.
  4. Thread A resumes and executes its pending call to Add(), dereferencing the dangling pointer to the freed LinearHistogram object.

Inside LinearHistogram::Add, the code accesses an inline WTF::Vector (buckets_) and performs an increment: ++buckets_[ix]. By using PartitionAlloc heap spraying to reclaim the freed LinearHistogram memory block, an attacker can overwrite the WTF::Vector base object to control its inline backing pointer (buffer_) and size_. This turns the ++buckets_[ix] operation into a constrained arbitrary memory increment primitive, which can be leveraged to hijack control flow (RCE) in the Renderer process.

Potential Steps to Trigger

  1. An attacker hosts a malicious page that establishes an RTCPeerConnection.
  2. The page captures a video stream (e.g., using canvas.captureStream()) and adds it to the connection.
  3. The attacker uses RTCRtpSender.setParameters() to configure simulcast with multiple layers, deliberately mixing a very high resolution and a very low resolution to force a mixed hardware/software encoding state.
  4. The concurrent encoding of frames on these layers triggers the race condition in StatsCollector::AddProcessingTime.
  5. Concurrent heap spraying via JavaScript is used to reclaim the freed LinearHistogram and control the WTF::Vector backing pointer.

Note: These are suggested/potential steps to trigger the vulnerability based on code analysis. Our tooling agent does not currently have the ability to run code or provide a working Proof of Concept.

Suggested Fix

Synchronization is missing in StatsCollector. A base::AutoLock should be introduced in StatsCollector::AddProcessingTime to protect the processing_time_ms_histogram_ pointer, the current_stats_key_, and the histogram data itself. Alternatively, StatsCollectingEncoder should post all metric collection tasks to a single designated sequence to ensure thread safety.

Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b


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 statistics collector is shared between encoder callbacks that run on different threads without a lock, so a configuration change on one thread can destroy the histogram object another thread is still using.

Impact

If successfully exploited, this could provide an arbitrary memory increment primitive, potentially leading to remote code execution within the renderer sandbox; the report notes the steps are only potential and no working proof of concept was produced.

What the attacker needed

Victim visits attacker page; WebRTC simulcast with mixed resolutions; both hardware and software encoders used

The fix

A lock should be added around the histogram pointer, the current statistics key and the histogram data in the processing-time function, or all metric collection should be posted to a single designated sequence.

How it was found

  1. Host a page that opens a WebRTC peer connection.
  2. Capture a video stream from the page and add it to the connection.
  3. Configure simulcast layers with very different resolutions to force a mixed hardware and software encoder setup.
  4. Let frames encode concurrently on both layers so the race in the statistics collector is triggered.
  5. Heap spray from JavaScript to reclaim the freed histogram and control the vector backing pointer.

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 video call sends several quality levels at once, the browser may use a hardware encoder for one level and a software encoder for another. These two encoders report their results on different threads, which are separate lines of work running at the same time. The code that stores the statistics was not protected against both threads touching it together, so one thread could delete a counter while the other was still updating it, and the second thread then writes into memory that no longer belongs to it.

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.