Use after free in WebRTC (CVE-2026-11054)
A race condition in WebRTC session description handling can cause a persistent handle to be destroyed on the wrong thread, corrupting the garbage collector's free-list and potentially leading to a use-after-free. An attacker could trigger this by creating an offer in an iframe and then removing the iframe, potentially leading to memory corruption and code execution.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 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 security team.
Overview: A race condition in CreateSessionDescriptionRequest can cause a cppgc::Persistent handle to be destroyed on the WebRTC signaling thread when an iframe is detached. This causes an unsynchronized modification of the main thread's cppgc free-list, leading to Oilpan heap corruption and a potential Use-After-Free (UAF).
Affected files:
third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.ccthird_party/blink/renderer/platform/heap/persistent.h
Estimated timestamp from git blame: 2025-10-21
Summary
A potential vulnerability exists in rtc_peer_connection_handler.cc where CreateSessionDescriptionRequest incorrectly manages the lifecycle of a cppgc::Persistent handle. If an iframe is detached while an asynchronous WebRTC operation is pending, the request object can be destructed on the WebRTC signaling thread. cppgc::Persistent is not thread-safe; its cross-thread destruction corrupts the main thread's Garbage Collection (Oilpan) free-list, which can lead to a highly exploitable Use-After-Free (UAF).
Potential Steps to Trigger
Note: These are suggested steps based on static analysis, as our tooling agent cannot yet run live proofs of concept.
- An attacker hosts a page with an
<iframe>. - Inside the iframe, JavaScript creates a WebRTC connection and triggers
peerConnection.createOffer()(orcreateAnswer()). - Immediately after triggering the offer, the attacker's main page removes the iframe from the DOM (
iframe.remove()). - The WebRTC thread finishes generating the offer and attempts to return it to the main thread.
- The free-list is corrupted. The attacker allocates multiple objects to trigger shared nodes, then forces a garbage collection cycle to trigger a UAF on a live JavaScript/DOM object.
Technical Details
- When
pc.createOffer()is called, Blink creates aCreateSessionDescriptionRequest(rtc_peer_connection_handler.cc:962). - This object holds a
cppgc::Persistent<RTCSessionDescriptionRequest> webkit_request_to keep the JS request object alive across the async boundary. - A raw pointer to this ref-counted request is passed to the native WebRTC layer, which wraps it in a
scoped_refptrand passes it to the WebRTC signaling thread. - When the iframe is removed, its
FrameSchedulerImplis destroyed, shutting down the frame'sTaskQueueand invalidating itsTaskRunner(main_thread_). - Once the WebRTC signaling thread finishes the offer, it calls
CreateSessionDescriptionRequest::OnSuccessUniquePtr. - Because it is on a background thread, it attempts to post a task back using
PostCrossThreadTask(rtc_peer_connection_handler.cc:164). - The Bug:
PostCrossThreadTaskdirectly usesbase::SequencedTaskRunner::PostTask. Because themain_thread_task runner is shut down,PostTaskreturnsfalse. Consequently, thebase::OnceCallbackand its capturedscoped_refptrare destroyed immediately on the WebRTC signaling thread. - This drops the final reference to the
CreateSessionDescriptionRequest, invoking its destructor (and the~Persistentdestructor) on the signaling thread. PersistentRegionBase::FreeNodeexecutes on the WebRTC thread. In Release builds, theCPPGC_DCHECK(IsCreationThread())is compiled out, so the method writes to the main thread'sfree_list_head_without taking any locks.- Concurrently, the main thread may be allocating new
Persistenthandles. The unsynchronized writes corrupt the singly-linked free-list, allowing two livePersistenthandles to share the samePersistentNode. When one is cleared, the GC will fail to trace the other, leading to a UAF.
Suggested Fix
There are two primary ways to fix this:
- Use
CrossThreadPersistent: Change the type ofwebkit_request_fromcppgc::Persistenttocppgc::CrossThreadPersistent.CrossThreadPersistentRegionuses a process-global lock (PersistentRegionLock), which safely handles node allocation and destruction across thread boundaries. - Safe Callback Destruction: Instead of using
PostCrossThreadTask, use a mechanism that guarantees the callback and its bound arguments are destroyed on the target thread, even if the task runner is shut down. For instance,blink::BindPostTaskusesbase::OnTaskRunnerDeleterto ensure safe destruction, preventing the closure from being dropped on the signaling thread.
Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33
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.
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 root cause is that a `cppgc::Persistent` handle is destroyed on a background thread when a task runner is shut down, and the persistent region's free-list is not thread-safe, leading to corruption.
Impact
This could lead to a use-after-free, potentially allowing an attacker to execute arbitrary code or cause a denial of service.
What the attacker needed
Victim visits attacker's page; browser supports WebRTC
The fix
The bug should be fixed by using `CrossThreadPersistent` instead of `Persistent`, or by ensuring safe callback destruction on the target thread.
How it was found
- An attacker hosts a page with an iframe.
- Inside the iframe, JavaScript creates a WebRTC connection and triggers createOffer().
- Immediately after triggering the offer, the attacker's main page removes the iframe from the DOM.
- The WebRTC thread finishes generating the offer and attempts to return it to the main thread.
- The free-list is corrupted. The attacker allocates multiple objects to trigger shared nodes, then forces a garbage collection cycle to trigger a 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.
This report describes a bug in how a web browser handles WebRTC (a technology for real-time communication) when an iframe is removed. The bug could let an attacker corrupt the browser's memory management, potentially leading to crashes or even running malicious code. The issue is a race condition, meaning it depends on precise timing between threads.
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.