Skip to content
Memory corruption Advisory Advanced CVE-2026-9887

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

Critical View original
  • 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.cc
  • services/proxy_resolver/proxy_resolver_v8_tracing.cc
  • gin/v8_foreground_task_runner_with_locker.cc
  • v8/src/heap/heap.cc
  • v8/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:

  1. Stall Thread A: The attacker provides a PAC script for Resolver A that calls dnsResolve("slow.server.com") during initialization. This call drops the v8::Locker and completely blocks Thread A waiting on a base::WaitableEvent.
  2. Queue Cleanup Task: While Thread A is blocked, Resolver B runs on Thread B, creates a FinalizationRegistry, registers a callback (e.g., calling alert()), and drops object references to trigger GC. V8 posts the cleanup task to Thread A's currently blocked message loop.
  3. Destroy Context: Resolver B is destroyed (e.g., via a WPAD update). Its C++ ProxyResolverV8::Context object is freed. However, the v8::External object containing the raw this pointer remains alive in V8's heap, tied to the pending cleanup task.
  4. Groom the Heap: The attacker uses another active PAC script to spray allocations via PartitionAlloc (e.g., using unbounded DNS cache entries in Job::dns_cache_). Because the freed Context object is small (~80 bytes), the attacker can cleanly overwrite it with controlled data.
  5. Execute Callback: The DNS resolution on Thread A completes. Thread A unblocks, finishes its script, and processes its message loop, executing the queued FinalizationRegistryCleanupTask.
  6. UAF / RCE: The JS cleanup callback calls alert(), invoking the C++ ProxyResolverV8::Context::AlertCallback. The code extracts the dangling Context* pointer from the v8::External data. 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:

  1. Disable FinalizationRegistry in PAC Scripts: PAC scripts are designed to be simple, synchronous functions (FindProxyForURL). They should not have access to advanced asynchronous features like FinalizationRegistry. Removing this feature from the V8 context created for PAC scripts eliminates the vulnerability class entirely.
  2. Invalidate Callbacks on Context Destruction: Ensure that the C++ ProxyResolverV8::Context explicitly clears or invalidates the v8::External pointer (or uses a base::WeakPtr equivalent for V8 callbacks) when it is destroyed, preventing C++ callbacks from dereferencing this after 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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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

  1. Stall Thread A by providing a PAC script for Resolver A that calls dnsResolve on a slow server during initialisation, blocking Thread A.
  2. 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.
  3. Destroy Resolver B (e.g., via a WPAD update), freeing its C++ Context object while the v8::External pointer remains alive.
  4. Groom the heap using another active PAC script to spray allocations and overwrite the freed Context object with controlled data.
  5. Let the DNS resolution on Thread A complete, unblocking it so it processes its message loop and executes the queued FinalizationRegistryCleanupTask.
  6. 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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.