Use after free in WebRTC (CVE-2026-10975)
WebRTC's reference counter for RTCCertificate objects is a 32-bit signed atomic integer that wraps on overflow without checks. An attacker could supply a very large number of duplicate certificates in an RTCConfiguration to wrap the count and cause a use-after-free of the certificate in the renderer.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 20 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: WebRTC's RefCounter uses a 32-bit signed atomic integer without overflow checks, allowing the reference count to wrap around. An attacker could potentially exploit this by supplying a large number of duplicate certificates in the RTCConfiguration to trigger a Use-After-Free of an RTCCertificate. These references are not protected by MiraclePtr, making the issue potentially exploitable in the renderer process.
Affected files:
third_party/webrtc/rtc_base/ref_counter.hthird_party/webrtc/api/ref_counted_base.hthird_party/blink/renderer/modules/peerconnection/rtc_configuration.idlthird_party/blink/renderer/modules/peerconnection/rtc_peer_connection.ccthird_party/webrtc/rtc_base/rtc_certificate.h
Estimated timestamp from git blame: 2017-11-01
Summary
A potential Use-After-Free (UAF) vulnerability exists in WebRTC due to a 32-bit reference counter overflow in the webrtc_impl::RefCounter class. This class is used to manage the lifecycle of webrtc::RTCCertificate objects. By supplying a large number of duplicate certificates in an RTCConfiguration, an attacker might be able to cause the reference count to wrap around, leading to the premature deletion of the certificate object while references still exist.
Root Cause Analysis
The issue is located in third_party/webrtc/rtc_base/ref_counter.h. The RefCounter class uses a std::atomic<int> (which is a 32-bit signed integer on all Chromium-supported platforms) to store the reference count. The IncRef() method increments this count using fetch_add without saturation or overflow checks:
// third_party/webrtc/rtc_base/ref_counter.h
void IncRef() {
ref_count_.fetch_add(1, std::memory_order_relaxed);
}
Atomic fetch_add on signed integers is defined to wrap around modulo 2^N. When the counter wraps and eventually returns to a low value (e.g., 1), a subsequent Release() call will see the counter reach zero, triggering the object's destruction via delete this in third_party/webrtc/api/ref_counted_base.h.
This implementation differs from Chromium's base::RefCounted, which includes explicit CHECKs to prevent overflow on 64-bit systems.
Potential Trigger Path
An attacker might be able to drive the reference count to overflow through the following suggested steps:
- Unbounded Sequence: The
RTCConfiguration.certificatessequence is defined in Blink's IDL without a length limit. An attacker can generate a single certificate and create a JavaScript array containing millions of references to it (e.g., 4.3 million). - Configuration Conversion: When creating an
RTCPeerConnection, Blink converts this sequence into astd::vector<scoped_refptr<RTCCertificate>>. Each entry increments the certificate's reference count. [third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc:387] - Multiple Copies: Persistent copies of the configuration are maintained in
RTCPeerConnectionHandlerandwebrtc::PeerConnection. With a limit of 500 activeRTCPeerConnections per renderer, an attacker can theoretically create enough references (~2^32) to cause an overflow, requiring approximately 34GB of memory on a 64-bit system. - Use-After-Free: Once the counter wraps, destroying one
RTCPeerConnection(or triggering garbage collection) causes the counter to reach zero, deleting theRTCCertificate. Billions of danglingscoped_refptrs remain in the other active connections.
Impact
webrtc::scoped_refptr is a separate implementation from Chromium's smart pointers and does not use base::raw_ptr, meaning it lacks MiraclePtr (BackupRefPtr) protection. A UAF here could allow an attacker to reclaim the freed memory and then call methods like getFingerprints() on a dangling reference. This triggers a virtual call on the underlying SSLIdentity object, potentially allowing for arbitrary code execution (RCE) within the sandboxed renderer.
Suggested Fix
The webrtc_impl::RefCounter should be updated to include overflow checks, similar to base::RefCounted. Specifically, IncRef() should CHECK that the increment does not result in a wrap-around to zero or a negative value.
void IncRef() {
int prev = ref_count_.fetch_add(1, std::memory_order_relaxed);
CHECK_GT(prev, 0);
}
Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e
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.
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
The RefCounter uses a 32-bit signed atomic integer incremented with fetch_add and no overflow check, so the count can wrap around and reach zero while references still exist.
Impact
A use-after-free in the renderer could let an attacker reclaim the freed memory and make a virtual call on the dangling SSLIdentity, potentially allowing arbitrary code execution inside the sandboxed renderer; the text notes this is theoretical and needs about 34GB of memory.
What the attacker needed
Renderer process; about 34GB of memory; up to 500 active RTCPeerConnections
The fix
The RefCounter should be changed to check for overflow on increment, similar to Chromium's base::RefCounted.
How it was found
- Create one certificate and build a JavaScript array with millions of references to it, since the certificates sequence has no length limit.
- Pass that array as RTCConfiguration.certificates when creating an RTCPeerConnection, so each entry increments the certificate's reference count.
- Rely on persistent copies of the configuration in the handler and PeerConnection, and on up to 500 active connections per renderer, to reach roughly 2^32 references.
- Destroy one RTCPeerConnection or trigger garbage collection so the wrapped counter reaches zero and the certificate is deleted while other connections still hold references.
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.
Objects in memory are kept alive by counting how many parts of the program still use them; when the count hits zero the object is deleted. Here that count is a 32-bit number that silently wraps back to a small value if it gets too big, so the program can delete an object that is still in use. Using the deleted object afterwards (a use-after-free) can let an attacker control what happens next.
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.