Use after free in Network (CVE-2026-8530)
A potential use-after-free vulnerability exists in the Network Service during network revocation, where synchronous destruction of a factory during iteration can invalidate iterators and access freed memory. A compromised renderer could potentially trigger this reliably using deferred completion via Shared Dictionaries, leading to memory corruption.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
Flapjack (go/flapjack), an LLM-powered static analysis tool, has identified the following potential security issue.
Overview: A Use-After-Free (UAF) vulnerability may exist in the Network Service during network revocation. Synchronous destruction of a PrefetchMatchingURLLoaderFactory and its CorsURLLoaderFactory during a std::set iteration can invalidate iterators and access freed members. This issue could potentially be triggered reliably by a compromised renderer using deferred completion via Shared Dictionaries.
Affected files:
services/network/network_context.ccservices/network/cors/cors_url_loader_factory.cc
Estimated timestamp from git blame: 2024-06-03
Summary
A potential Use-After-Free (UAF) vulnerability exists in the Network Service during network revocation. When NetworkContext::RevokeNetworkForNonces is called, it iterates over its url_loader_factories_ set. If a factory is destroyed synchronously during this iteration, it is removed from the set, invalidating the iterator and leading to a UAF. Additionally, the factory itself may access its own members after being destroyed.
Vulnerability Details
The vulnerability stems from the synchronous destruction of PrefetchMatchingURLLoaderFactory and CorsURLLoaderFactory objects during a call to RevokeNetworkForNonces.
- NetworkContext::RevokeNetworkForNonces: This function in
services/network/network_context.cciterates over theurl_loader_factories_set (astd::set) using a range-basedforloop and callsCancelRequestsIfNonceMatchesAndUrlNotExemptedon each factory. - CorsURLLoaderFactory::CancelRequestsIfNonceMatchesAndUrlNotExempted: In
services/network/cors/cors_url_loader_factory.cc, this function defines a lambdaiterate_over_setto iterate over internal sets of loaders (url_loaders_andcors_url_loaders_) to cancel them. It callsloader->CancelRequestIfNonceMatchesAndUrlNotExempted. - Synchronous Destruction: Cancelling a
CorsURLLoadercallsHandleComplete(net::ERR_NETWORK_ACCESS_REVOKED). This synchronously executes the loader'sdelete_callback_, triggeringDestroyCorsURLLoaderon the factory, which erases the loader fromcors_url_loaders_and callsDeleteIfNeeded(). - Factory Erasure: If the factory has no more active loaders (
url_loaders_.empty()andcors_url_loaders_.empty()) and its Mojo pipe is closed (!owner_->HasAdditionalReferences()),DeleteIfNeeded()synchronously destroys the factory viaowner_->DestroyURLLoaderFactory(this). This reachesNetworkContext::DestroyURLLoaderFactory, which erases thePrefetchMatchingURLLoaderFactoryfromNetworkContext::url_loader_factories_. This immediately deletes theCorsURLLoaderFactory(this).
Exploitation Scenarios (Suggested)
Because DeleteIfNeeded requires both url_loaders_ and cors_url_loaders_ to be empty, a naive cancellation might not trigger the bug if the underlying network::URLLoader is still in url_loaders_ when the CorsURLLoader is canceled. However, an attacker can reliably trigger the bug using a Shared Dictionary response to defer the completion of the CorsURLLoader.
A compromised renderer could potentially trigger this by following these steps:
- Create Factory: Create a
URLLoaderFactorytied to anIsolationInfowith a specificnonce(e.g., via a Fenced Frame). - Start Request: Start a CORS-enabled fetch request to an attacker-controlled server. This creates a
CorsURLLoader(incors_url_loaders_) and an underlyingnetwork::URLLoader(inurl_loaders_). - Shared Dictionary Response: The server responds with a valid Shared Dictionary header and a large body. The Network Service creates a
SharedDictionaryDataPipeWriterto write the body to disk. - Defer Completion: Once the dictionary is downloaded, the
network::URLLoadercallsNotifyCompleted(). Becauseshared_dictionary_data_pipe_writer_is active,CorsURLLoader::OnCompletedefers its own completion and does not callHandleComplete(). Thenetwork::URLLoaderis then deleted and removed fromurl_loaders_. - Critical State:
url_loaders_is now completely empty, but theCorsURLLoaderremains incors_url_loaders_waiting for the disk write. - Close Pipe: The renderer drops its end of the
URLLoaderFactoryMojo pipe (receivers_.empty()becomes true). - Revoke Network: The renderer immediately triggers a network revocation for the
nonce(e.g., via Fenced Frame untrusted beacons).
When NetworkContext::RevokeNetworkForNonces reaches the deferred CorsURLLoader, it cancels it. HandleComplete() runs, removing the loader from cors_url_loaders_. DeleteIfNeeded() now sees all conditions met (both loader sets empty, pipe closed) and synchronously deletes the factory.
This leads to two distinct, highly exploitable UAF scenarios:
- CorsURLLoaderFactory Member Access: The stack unwinds to the
iterate_over_set(cors_url_loaders_)lambda in the deletedCorsURLLoaderFactory. The loop conditionloader_it != url_loaders.end()evaluates.end()on a reference to the freedthis->cors_url_loaders_. - NetworkContext Iterator Invalidation: If the first UAF doesn't crash, the stack unwinds to
NetworkContext::RevokeNetworkForNonces. The range-basedforloop attempts to increment the invalidatedstd::setiterator (++__begin), accessing the freed internal tree nodes of theurl_loader_factories_set.
Impact
Since the Network Service is a highly privileged process handling sensitive cross-origin data, this Use-After-Free is likely exploitable for Remote Code Execution (RCE) and subsequent sandbox escape.
Evaluated with Chrome root at commit: 843d0814f9a6e06cb8c6dd3ea7d5613ff9ffda45
Results from Flapjack so far have been promising, but it can be wrong in its deductions. At this time, it does not produce proof of concepts or fuzzer tests. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve Flapjack’s 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 synchronous destruction of a factory during iteration over a set invalidates the iterator and leads to accessing freed memory.
Impact
This use-after-free is likely exploitable for Remote Code Execution (RCE) and subsequent sandbox escape, as the Network Service is a highly privileged process.
What the attacker needed
Compromised renderer; attacker-controlled server; ability to create Fenced Frame
How it was found
- Create a URLLoaderFactory tied to an IsolationInfo with a specific nonce.
- Start a CORS-enabled fetch request to an attacker-controlled server.
- The server responds with a valid Shared Dictionary header and a large body.
- The network::URLLoader calls NotifyCompleted(), and CorsURLLoader defers completion due to active shared dictionary writer.
- The renderer drops its end of the URLLoaderFactory Mojo pipe.
- The renderer triggers a network revocation for the nonce.
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 is a bug where a program keeps using memory after it has been freed, which can let an attacker control what happens next. Here, the network service might free an object while still looping over a list that contains it, causing it to read or write freed memory. This could crash the service or, worse, let an attacker run their own code.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.