Use after free in WebView (CVE-2026-11072)
A race condition in AwPacProcessor allows an asynchronous Android network callback to run after the native object is freed, passing a dangling pointer through JNI. A local malicious app with VpnService permission could exploit this use-after-free to achieve arbitrary code execution in the privileged PAC processor service.
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 race condition in AwPacProcessor allows an asynchronous Android network callback to execute after the underlying native object is destroyed. This causes a dangling pointer to be passed through JNI, leading to a potential Use-After-Free (UAF). A local malicious app could exploit this to achieve arbitrary code execution in the highly privileged Android PAC processor service (UID 1000).
Affected files:
android_webview/java/src/org/chromium/android_webview/AwPacProcessor.javaandroid_webview/browser/aw_pac_processor.ccandroid_webview/browser/aw_pac_processor.h
Estimated timestamp from git blame: 2025-06-30
Description
A race condition exists in AwPacProcessor.java between the destroy() method and asynchronous ConnectivityManager callbacks. This leads to a potential Use-After-Free (UAF) vulnerability where native C++ methods are called on a deleted object.
When AwPacProcessor.destroy() is called, it unregisters the network callback and immediately deletes the native C++ object (destroyNative). However, Android's unregisterNetworkCallback does not purge pending onLinkPropertiesChanged callbacks already queued on the ConnectivityThread's MessageQueue.
Because AwPacProcessor lacks a destruction flag (and mNativePacProcessor is a final long that cannot be cleared), any delayed callback will execute successfully and pass the dangling pointer via JNI to AwPacProcessorJni.get().setNetworkAndLinkAddresses().
Potential Exploitation Steps
Note: These are potential steps; our tooling agent does not have the ability to run code to verify a live proof of concept.
- Triggering the Race: A local attacker app granted
VpnServicepermission establishes a VPN and rapidly adds/removes IP addresses, flooding theConnectivityThreadwith callbacks. - Freeing the Object: The system gracefully destroys the
AwPacProcessor. The 40-byte C++ object is freed into a 48-byte PartitionAlloc bucket. - Late Execution: A delayed callback fires, extracting the attacker-controlled VPN IP addresses and passing them through JNI.
- Heap Reclamation: The generated JNI stub converts the Java
List<String>to a C++std::vector<std::string>. If the attacker provides exactly two IP addresses, this allocates exactly 48 bytes, reliably reclaiming the recently freedAwPacProcessorobject. - Pointer Forgery: The first IP address is copied into the first
std::string. Under Chromium's libc++ (ABI v2), Small String Optimization (SSO) places the character data at offset 0. Characters 8-15 of the attacker's string perfectly overlap thehost_resolver_pointer field of the reclaimed object. - UAF Execution: The JNI stub casts the dangling
longto anAwPacProcessor*and callsSetNetworkAndLinkAddresses. It reads the attacker-forgedhost_resolver_pointer and posts a task usingbase::Unretained(host_resolver_.get()). - Memory Corruption: When the background task executes
HostResolver::SetNetworkAndLinkAddresses, it performs astd::vectorassignment (link_addresses_ = link_addresses;) on the forged target. By controlling the target vector's pointers, the attacker achieves Arbitrary Free and Constrained Arbitrary Write primitives, ultimately leading to code execution in thecom.android.pacprocessorprocess.
Suggested Fix
- Java Layer (Primary Fix): Add a
private boolean mIsDestroyed = false;flag toAwPacProcessor.java. Set this flag totrueinsidedestroy(). Checkif (mIsDestroyed) return;at the beginning ofonLinkPropertiesChanged()or before any native JNI calls are made to prevent using the danglingmNativePacProcessorhandle. - C++ Layer (Defense in Depth): Avoid using
base::UnretainedinAwPacProcessor::SetNetworkAndLinkAddresseswhen posting tasks to theHostResolver. Consider using abase::WeakPtrfor theAwPacProcessoror managing theHostResolverlifetime such that pending tasks are safely canceled or invalidated upon destruction.
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 destroy() method unregisters the network callback and immediately deletes the native object, but pending callbacks already queued on the ConnectivityThread are not purged, and there is no destruction flag to block them.
Impact
A local malicious app could potentially achieve arbitrary code execution in the highly privileged Android PAC processor service (UID 1000), though the report notes the steps are potential and were not verified with a live proof of concept.
What the attacker needed
Local malicious app; VpnService permission granted; ability to rapidly add/remove VPN IP addresses; timing to trigger race condition
The fix
The report suggests adding a destruction flag in Java to block callbacks after destroy(), and in C++ avoiding base::Unretained by using base::WeakPtr or managing the HostResolver lifetime so pending tasks are cancelled or invalidated.
How it was found
- A local attacker app with VpnService permission establishes a VPN and rapidly adds/removes IP addresses to flood the ConnectivityThread with callbacks.
- The system gracefully destroys the AwPacProcessor, freeing the 40-byte C++ object into a 48-byte PartitionAlloc bucket.
- A delayed callback fires, extracting the attacker-controlled VPN IP addresses and passing them through JNI.
- The JNI stub converts the Java List<String> to a C++ std::vector<std::string>; providing exactly two IP addresses allocates exactly 48 bytes, reclaiming the freed object.
- The first IP address is copied into the first std::string; under libc++ SSO, characters 8-15 overlap the host_resolver_ pointer field of the reclaimed object.
- The JNI stub casts the dangling long to an AwPacProcessor* and calls SetNetworkAndLinkAddresses, reading the forged host_resolver_ pointer and posting a task with base::Unretained.
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 later uses a pointer to that freed memory, which can let an attacker control what happens next. Here, a background network event can fire after the object is gone, and a malicious app on the same device could try to take advantage of that timing to run its own code in a powerful system service.
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.