Use after free in Proxy (CVE-2026-9887)
A use-after-free exists in the proxy resolver because multiple resolver instances share a V8 isolate whose task runner is bound to the first resolver's thread. An attacker could use a PAC script's FinalizationRegistry to queue a callback that runs after the resolver's context is destroyed, potentially leading to remote code execution.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 20 days
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential Use-After-Free exists in the proxy resolver service due to improper lifecycle management of a shared V8 isolate's task runner. An attacker can use a PAC script's FinalizationRegistry to queue a callback that executes after the resolver's context is destroyed, bypassing MiraclePtr and leading to RCE.
Affected files:
services/proxy_resolver/proxy_resolver_v8.ccservices/proxy_resolver/proxy_resolver_v8_tracing.ccgin/v8_foreground_task_runner_with_locker.ccv8/src/heap/heap.ccv8/src/heap/finalization-registry-cleanup-task.cc
Estimated timestamp from git blame: 2025-10-02
Overview
A potential Use-After-Free (UAF) vulnerability exists in the PAC (Proxy Auto-Config) resolver implementation. The issue stems from how multiple ProxyResolverV8 instances share a single v8::Isolate and its associated foreground task runner. An attacker can manipulate JavaScript garbage collection using FinalizationRegistry to schedule a cleanup task that executes after the originating ProxyResolverV8::Context has been destroyed. Because the dangling pointer is retrieved from a v8::External object, it bypasses MiraclePtr (BackupRefPtr) protections, allowing for Remote Code Execution (RCE).
Technical Details
When multiple proxy resolvers are active in the same process, they share a global v8::Isolate managed by SharedIsolateFactory. The factory lazily initializes the isolate via gin::IsolateHolder upon the first request. Crucially, it binds the isolate's foreground task runner to the worker thread of the first resolver created (Thread A).
If a second resolver (Resolver B) executes a PAC script on its own worker thread (Thread B), it can create a FinalizationRegistry. When objects registered in this registry are garbage collected, V8 posts a FinalizationRegistryCleanupTask. Because the foreground task runner is permanently bound to Thread A, this cleanup task is queued on Thread A's message loop, regardless of which resolver triggered it.
An attacker can reliably trigger the UAF using the following sequence:
- Stall Thread A: The attacker provides a PAC script for
Resolver Athat callsdnsResolve("slow.server.com")during initialization. This call drops thev8::Lockerand completely blocksThread Awaiting on abase::WaitableEvent. - Queue Cleanup Task: While
Thread Ais blocked,Resolver Bruns onThread B, creates aFinalizationRegistry, registers a callback (e.g., callingalert()), and drops object references to trigger GC. V8 posts the cleanup task toThread A's currently blocked message loop. - Destroy Context:
Resolver Bis destroyed (e.g., via a WPAD update). Its C++ProxyResolverV8::Contextobject is freed. However, thev8::Externalobject containing the rawthispointer remains alive in V8's heap, tied to the pending cleanup task. - Groom the Heap: The attacker uses another active PAC script to spray allocations via
PartitionAlloc(e.g., using unbounded DNS cache entries inJob::dns_cache_). Because the freedContextobject is small (~80 bytes), the attacker can cleanly overwrite it with controlled data. - Execute Callback: The DNS resolution on
Thread Acompletes.Thread Aunblocks, finishes its script, and processes its message loop, executing the queuedFinalizationRegistryCleanupTask. - UAF / RCE: The JS cleanup callback calls
alert(), invoking the C++ProxyResolverV8::Context::AlertCallback. The code extracts the danglingContext*pointer from thev8::Externaldata. It then blindly dereferences the attacker-controlled memory to make a virtual function call (context->js_bindings()->Alert(message)), resulting in a control-flow hijack.
Note: These steps are based on static analysis of the Chromium codebase; our tooling does not yet execute code to provide a working proof of concept.
Exploitability
This vulnerability is highly exploitable because the dangling pointer is stored as a raw void* within a v8::External object. v8::External objects are managed by V8 and are not protected by MiraclePtr/BackupRefPtr. Furthermore, the attacker has excellent heap grooming capabilities within the proxy resolver process by caching long strings in dnsResolve calls.
On Desktop, this leads to RCE within the sandboxed proxy_resolver utility process. On Android (where the network service and proxy resolver often run in-process), this can lead to RCE directly in the browser process.
Suggested Fix
There are two primary ways to fix this issue:
- Disable FinalizationRegistry in PAC Scripts: PAC scripts are designed to be simple, synchronous functions (
FindProxyForURL). They should not have access to advanced asynchronous features likeFinalizationRegistry. Removing this feature from the V8 context created for PAC scripts eliminates the vulnerability class entirely. - Invalidate Callbacks on Context Destruction: Ensure that the C++
ProxyResolverV8::Contextexplicitly clears or invalidates thev8::Externalpointer (or uses abase::WeakPtrequivalent for V8 callbacks) when it is destroyed, preventing C++ callbacks from dereferencingthisafter the object is freed.
Evaluated with Chrome root at commit: eca8648a4e1cdfdda68c495a6003059fed641955
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 shared V8 isolate's foreground task runner is permanently bound to the first resolver's thread, so cleanup tasks from other resolvers are queued there and can execute after their context is freed, with the dangling pointer stored in a v8::External that bypasses MiraclePtr.
Impact
On desktop this could lead to remote code execution within the sandboxed proxy_resolver utility process, and on Android it could lead to remote code execution directly in the browser process.
What the attacker needed
Multiple proxy resolvers active; attacker controls PAC script; WPAD update to destroy resolver
The fix
The issue should be fixed by either disabling FinalizationRegistry in PAC scripts or invalidating the v8::External pointer when the context is destroyed.
How it was found
- Stall Thread A by providing a PAC script for Resolver A that calls dnsResolve on a slow server during initialisation, blocking Thread A.
- While Thread A is blocked, Resolver B on Thread B creates a FinalizationRegistry, registers a callback, and drops object references to trigger garbage collection, queuing a cleanup task on Thread A.
- Destroy Resolver B (e.g., via a WPAD update), freeing its C++ Context object while the v8::External pointer remains alive.
- Groom the heap using another active PAC script to spray allocations and overwrite the freed Context object with controlled data.
- Let the DNS resolution on Thread A complete, unblocking it so it processes its message loop and executes the queued FinalizationRegistryCleanupTask.
- The JS cleanup callback calls alert(), invoking the C++ AlertCallback which dereferences the dangling Context pointer and makes a virtual function call, resulting in control-flow hijack.
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 some memory but later still uses a pointer to it, like deleting a file and then trying to open it. Here, a proxy configuration script can schedule a delayed action that runs after the object it needs has been deleted, so the program reads attacker-controlled memory. This could let an attacker run their own code on the machine.
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.