Use after free Network (CVE-2026-12012)
A use-after-free vulnerability in Chrome's SPDY buffer handling allows a malicious HTTP/2 proxy to trigger reentrant stream closure, freeing a buffer while its callbacks are being iterated. This could lead to remote code execution in the network process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the security team.
Overview: A potential Use-After-Free vulnerability exists in SpdyBuffer::ConsumeHelper due to a reentrant call to SpdyReadQueue::Dequeue during stream closure. An attacker controlling an HTTP/2 proxy server can trigger this reentrancy, freeing the SpdyBuffer while its consume_callbacks_ are being iterated, potentially leading to Remote Code Execution.
Affected files:
net/spdy/spdy_buffer.ccnet/spdy/spdy_read_queue.ccnet/spdy/spdy_proxy_client_socket.ccnet/spdy/spdy_session.cc
Estimated timestamp from git blame: 2025-07-01
Description
A potential Use-After-Free (UAF) vulnerability exists in the Chrome network stack, specifically within SpdyBuffer::ConsumeHelper in net/spdy/spdy_buffer.cc. The issue arises because ConsumeHelper iterates over its consume_callbacks_ vector and executes callbacks synchronously without a reentrancy guard or protection against the SpdyBuffer instance being destroyed mid-iteration.
Technical Analysis & Suggested Reproduction Steps
This vulnerability can be triggered via a reentrancy path through SpdyProxyClientSocket when handling incoming data from a malicious HTTP/2 proxy server.
An attacker could potentially trigger this by following these steps:
- Establish Proxy Connection: Set up a malicious HTTP/2 proxy server and establish a proxy connection with Chrome, creating a
SpdyProxyClientSocketand aSpdyStream. - Initiate Read: Wait for Chrome's TLS stack or consumer to issue a read request via
SpdyProxyClientSocket::Read. The socket saves theuser_buffer_(sizeN) andread_callback_. - Saturate Write Queue: Advertise a TCP window of 0 to block Chrome from writing, and send 10,000 HTTP/2 PING frames. This fills the
SpdySession'swrite_queue_with capped PING ACK frames until it reachessession_max_queued_capped_frames_(10,000). - Send Malicious DATA Frame: Send a single DATA frame with a payload size
Pchosen such thatN < P ≤ 2N. - Process Data: Chrome receives the DATA frame, wraps it in a
SpdyBuffer, adds aSpdyStream::OnReadBufferConsumedcallback, and passes it toSpdyProxyClientSocket::OnDataReceived. - Outer Dequeue & Consume: Because
read_callback_is set,OnDataReceivedcallsPopulateUserReadBuffer→SpdyReadQueue::Dequeue. SinceP > N,Dequeuepartially consumes the buffer by copyingNbytes and callingbuffer->Consume(N), leaving the buffer at the front of the queue. - Callback Execution:
SpdyBuffer::ConsumecallsConsumeHelper, which enters aforloop overconsume_callbacks_. It executes the first callback:SpdyStream::OnReadBufferConsumed. - Trigger Session Drain:
OnReadBufferConsumedupdates the receive window, triggeringSpdySession::SendStreamWindowUpdate→EnqueueSessionWrite. Because the write queue is already full of PING ACKs (10,000 frames), the additional WINDOW_UPDATE frame exceeds the limit (10,001), triggeringSpdySession::DoDrainSession. - Synchronous Stream Closure:
DoDrainSessionsynchronously closes all streams, callingSpdyStream::OnClose(status), which invokes its delegate,SpdyProxyClientSocket::OnClose. - Reentrant OnDataReceived: Inside
SpdyProxyClientSocket::OnClose, sinceread_callback_is not null (the outerOnDataReceivedhasn't cleared it yet), it synchronously callsOnDataReceived(nullptr). - Inner Dequeue & Buffer Free: The inner
OnDataReceivedseesuser_buffer_is still set and callsPopulateUserReadBuffer→SpdyReadQueue::Dequeueagain, with the same sizeN. The remaining size of the frontSpdyBufferisP - N. BecauseP ≤ 2N, the remaining size is≤ N.Dequeuecopies the remaining data and executesqueue_.pop_front(), destroying theSpdyBufferobject and freeing its memory. - Synchronous Heap Spray: The inner
OnDataReceivedfinishes and executesstd::move(read_callback_).Run(rv). The attacker'sP - Nbytes are passed to the consumer (e.g., the TLS stack). If these bytes are carefully crafted TLS records, they can be used to perform a synchronous, targeted heap spray during the callback execution, reclaiming the freedSpdyBufferand itsstd::vectorbacking store. - Use-After-Free Read & Execution: The call stack unwinds back to the outer
SpdyBuffer::ConsumeHelperforloop. Thethispointer is now dangling. The loop reads theend()iterator from the attacker-controlled reclaimed memory. The loop continues and callsit->Run(), executing a hijacked function pointer from a fakebase::RepeatingCallbackobject injected during the heap spray.
(Note: These are suggested steps based on source code analysis; our agent does not yet have the ability to run code to confirm a working exploit).
Impact
If successfully exploited, this vulnerability could allow an attacker to achieve arbitrary Remote Code Execution (RCE) in the Network Process. MiraclePtr does not mitigate this issue because the dangling references involve the this pointer and internal std::vector iterators rather than raw_ptr members.
Suggested Fix
There are a few potential ways to resolve this:
- PostTask for Callbacks: Instead of executing the consume callbacks synchronously in
SpdyBuffer::ConsumeHelper, post them to the thread's task runner. This ensures the callbacks run after the current stack unwinds, preventing synchronous reentrancy. - Clear Socket State Earlier: In
SpdyProxyClientSocket::OnDataReceived, clearread_callback_,user_buffer_, anduser_buffer_len_before callingPopulateUserReadBuffer. This breaks the reentrancy loop by ensuring the innerOnClosecall does not see a pending read state. - Reentrancy Guard: Add a
bool is_consuming_flag toSpdyBufferto detect and block or queue reentrant consumes.
Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the code iterates over callbacks without guarding against reentrancy, allowing the buffer to be destroyed mid-iteration.
Impact
If successfully exploited, this vulnerability could allow an attacker to achieve arbitrary Remote Code Execution (RCE) in the Network Process.
What the attacker needed
Malicious HTTP/2 proxy server; victim connects through the proxy
The fix
The report suggests posting callbacks asynchronously, clearing socket state earlier, or adding a reentrancy guard; it does not state that a fix was applied.
How it was found
- Set up a malicious HTTP/2 proxy server and establish a proxy connection with Chrome.
- Wait for Chrome to issue a read request, saving the user buffer and callback.
- Advertise a TCP window of 0 and send 10,000 PING frames to fill the write queue.
- Send a DATA frame with payload size P such that N < P ≤ 2N.
- Chrome processes the DATA frame, partially consumes the buffer, and triggers a callback that drains the session.
- The session closure reentrantly calls OnDataReceived, which frees the buffer, and then a heap spray reclaims it, leading to use-after-free.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A use-after-free happens when a program frees memory but then keeps using it, like deleting a file and then trying to open it. Here, a malicious proxy server can trick Chrome into freeing a buffer while it is still processing callbacks, and then the attacker can fill that memory with controlled data. This could let the attacker run their own code inside Chrome's network process.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.