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

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

A race condition in WebRTC certificate generation allows a main-thread garbage-collection handle to be destroyed on a worker thread, corrupting a lockless free-list. This can lead to a use-after-free and potential remote code execution in the renderer process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 54 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.

Overview: A race condition during asynchronous WebRTC certificate generation allows a thread-unsafe cppgc::Persistent handle to be destroyed on a worker thread if the originating iframe is removed. This off-thread destruction modifies the Oilpan PersistentRegion free-list without locking, causing memory corruption and potential Use-After-Free (UAF).

Affected files:

  • third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.cc
  • third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
  • v8/include/cppgc/internal/persistent-node.h
  • v8/include/cppgc/persistent.h

Estimated timestamp from git blame: 2025-11-26

Summary

There is a potential race condition and thread-safety violation in RTCCertificateGenerator that allows a main-thread cppgc::Persistent handle to be destroyed on a WebRTC worker thread. Because cppgc::PersistentNode freeing is lockless (assuming execution on the creation thread), this off-thread destruction corrupts the PersistentRegion free-list, leading to memory corruption, aliased handles, and potential Remote Code Execution (RCE) in the renderer process.

Vulnerability Details

The potential vulnerability occurs in the following sequence:

  1. Trigger: An attacker calls RTCPeerConnection.generateCertificate() from within an iframe, passing a large RSA modulus (e.g., 4096 bits) to intentionally delay the asynchronous generation process.
  2. Promise Binding: On the main thread, RTCPeerConnection::generateCertificate creates a ScriptPromiseResolver and wraps it in a thread-local cppgc::Persistent handle (WrapPersistent(resolver)). This handle is bound to the completion callback using WTF::BindOnce.
  3. Cross-Thread Handoff: The resulting base::OnceCallback is passed to the WebRTC worker thread via CrossThreadBindOnce and PostCrossThreadTask in RTCCertificateGeneratorRequest::GenerateCertificateAsync.
  4. Assertion Bypass: The cross-thread static assertions (CheckGCedTypeRestrictions, etc.) verify that a base::OnceCallback is safe to pass across threads, but they do not recursively inspect the callback's BindState. The thread-unsafe cppgc::Persistent handle is therefore successfully passed to the worker thread.
  5. Race Condition Window: The worker thread performs synchronous RSA key generation, blocking for several seconds.
  6. Frame Detachment: During this window, the attacker's script removes the iframe from the DOM. This detaches the frame, shuts down its ExecutionContext, and eventually shuts down its detached task queues (including blink::TaskType::kInternalMedia).
  7. Task Posting Failure: When the worker thread finishes generating the key, it attempts to post the result back to the main thread via PostCrossThreadTask using the now-destroyed kInternalMedia task runner.
  8. Off-Thread Destruction: Because the task queue is shut down, PostTask fails. PostCrossThreadTask takes ownership of the callback and immediately destroys it on the current thread (the worker thread).
  9. Lockless Modification: The callback's destruction invokes ~BasicPersistent(), which calls PersistentRegionBase::FreeNode(). In release builds, thread-safety DCHECKs are compiled out. FreeNode() updates the main-thread PersistentRegion free-list without any locking.

Exploitation and Impact

This lockless modification races with concurrent allocations or frees on the main thread. A "lost update" interleaving can cause a live, in-use PersistentNode to be erroneously linked back into the free-list.

When the main thread subsequently allocates a new Persistent handle, it pops the corrupted node. Two distinct Persistent handles now alias the exact same PersistentNode memory. The new handle overwrites the owner_ and trace_ fields of the node.

During Garbage Collection, the original Persistent handle is completely skipped because the node no longer points to it. The GC will collect the underlying object, resulting in a Use-After-Free (UAF) when the original handle is later accessed by Blink C++. Additionally, overlapping nodes can lead to type confusion.

Note: cppgc::PersistentNode uses raw pointers in a union, which explicitly cannot be protected by MiraclePtr (BackupRefPtr).

Suggested Fix

Ensure that cppgc::Persistent handles are not captured by value in callbacks that might be destroyed off-thread. One potential fix is to bind a CrossThreadPersistent handle instead of a regular Persistent handle, or ensure the callback is wrapped in a mechanism that guarantees destruction on the original sequence (e.g., using base::ScopedClosureRunner bound to the main thread, although care must be taken if the target queue is shut down).

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 a thread-unsafe garbage-collection handle is passed to a worker thread and destroyed there when the originating frame is removed, corrupting a lockless free-list.

Impact

This could lead to a use-after-free and potential remote code execution in the renderer process, though the report notes it is a potential issue and may be a false positive.

What the attacker needed

Victim visits a malicious page; attacker can run JavaScript; browser uses affected Chrome version

The fix

The suggested fix is to avoid capturing cppgc::Persistent handles by value in callbacks that might be destroyed off-thread, for example by using CrossThreadPersistent or ensuring destruction on the original sequence.

How it was found

  1. Call generateCertificate() from an iframe with a large RSA modulus to delay generation.
  2. Remove the iframe from the DOM while the worker thread is still generating the key.
  3. The worker thread finishes and tries to post the result back, but the task queue is shut down.
  4. The callback is destroyed on the worker thread, freeing the Persistent handle off-thread.
  5. This lockless modification races with main-thread allocations, corrupting the free-list.

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 web page asks the browser to create a security certificate, the browser does some work in the background. A bug means that if the page is closed at the wrong moment, the background work can accidentally free memory that the main page is still using. This can crash the browser or let an attacker run their own code.

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.