Use after free in WebView (CVE-2026-11080)
A use-after-free occurs in Android WebView when a permission request is cancelled and the embedder's cancellation callback synchronously calls deny() or grant(), freeing the native object while a cached raw pointer is still used. An attacker could crash the browser process by triggering a permission request and then navigating away, though remote code execution is considered extremely difficult.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 58 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 security team.
Overview: A Use-After-Free (UAF) vulnerability exists in the Android WebView browser process when a permission request is canceled. If an embedder application defensively calls grant() or deny() during the cancellation callback, the native object is synchronously deleted, leaving a dangling stack pointer that is subsequently accessed.
Affected files:
android_webview/browser/permission/permission_request_handler.ccandroid_webview/browser/permission/aw_permission_request.ccandroid_webview/java/src/org/chromium/android_webview/CleanupReference.javaandroid_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java
Estimated timestamp from git blame: 2015-05-06
Summary
A Use-After-Free (UAF) vulnerability exists in the Android WebView browser process within PermissionRequestHandler::CancelRequestInternal. The function caches a raw pointer to an AwPermissionRequest object and then performs a synchronous JNI call into the embedder application's code. If the embedder application calls request.deny() or request.grant() inside the onPermissionRequestCanceled callback, the native AwPermissionRequest object is synchronously deleted. When the JNI call returns, the cached pointer is dereferenced, leading to a UAF.
Technical Details
In android_webview/browser/permission/permission_request_handler.cc, the CancelRequestInternal function caches a raw stack pointer to the request:
void PermissionRequestHandler::CancelRequestInternal(RequestIterator i) {
AwPermissionRequest* request = i->get(); // Caches raw stack pointer
if (request) {
client_->OnPermissionRequestCanceled(request); // Synchronous JNI callback
request->CancelAndDelete(); // UAF happens here
}
}
The OnPermissionRequestCanceled call ultimately triggers a synchronous JNI callback to the Java method onPermissionRequestCanceled in the embedder's WebChromeClient.
If the embedder application calls deny() or grant() on the provided PermissionRequest adapter within this callback, it triggers a synchronous deletion chain in Java:
AwPermissionRequest.deny()callsdestroyNative().destroyNative()invokesmCleanupReference.cleanupNow().- Since this occurs on the UI thread, the cleanup task executes synchronously instead of posting to the looper.
- The cleanup task invokes
AwPermissionRequestJni.get().destroy(nativeAwPermissionRequest). - The native
AwPermissionRequest::Destroymethod executesdelete this;.
At this point, the AwPermissionRequest object is freed. However, PermissionRequestHandler::CancelRequestInternal still holds the cached raw pointer request on the stack. Because it is a local stack pointer rather than a class member, it bypasses MiraclePtr (BackupRefPtr) protections.
Upon returning from the JNI call, request->CancelAndDelete() is executed on the freed memory, causing a UAF write (processed_ = true) and a UAF read (retrieving the Java object reference).
Potential Attack Vector
- A malicious web page loaded in a WebView requests a permission (e.g., MIDI SysEx).
- The page triggers a navigation to a different origin.
- The navigation causes
PermissionRequestHandler::CancelAllRequeststo be called, which invokesCancelRequestInternal. - The embedder app's defensive
onPermissionRequestCanceledhandler callsdeny()on the canceled request. - The UAF is triggered upon returning to C++.
While achieving Remote Code Execution is extremely difficult due to the inability to run the message loop and reallocate memory synchronously during the callback, the vulnerability reliably crashes the browser process and represents a valid memory safety violation.
Suggested Fix
Use a base::WeakPtr to verify the object is still alive after the synchronous callback returns.
void PermissionRequestHandler::CancelRequestInternal(RequestIterator i) {
base::WeakPtr<AwPermissionRequest> request = *i;
if (request) {
client_->OnPermissionRequestCanceled(request.get());
if (request) {
request->CancelAndDelete();
}
}
}
Evaluated with Chrome root at commit: f200f57a19490707ff8bc7aa5de3cbc443a3afad
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
The code caches a raw pointer to an object, makes a synchronous callback that can delete the object, and then dereferences the stale pointer.
Impact
The vulnerability reliably crashes the browser process, but remote code execution is extremely difficult due to the inability to run the message loop and reallocate memory synchronously during the callback.
What the attacker needed
WebView with a permission request; Embedder calls deny() or grant() in callback; Victim loads a malicious page
The fix
Use a `base::WeakPtr` to verify the object is still alive after the synchronous callback returns.
How it was found
- A malicious web page loaded in a WebView requests a permission (e.g., MIDI SysEx).
- The page triggers a navigation to a different origin.
- The navigation causes `PermissionRequestHandler::CancelAllRequests` to be called, which invokes `CancelRequestInternal`.
- The embedder app's defensive `onPermissionRequestCanceled` handler calls `deny()` on the canceled request.
- The UAF is triggered upon returning to C++.
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 memory bug where a program keeps using a piece of memory after it has been freed. Here, WebView frees a permission request object during a callback, then tries to use it again, which can crash the app. An attacker can trigger this by making a web page request a permission and then navigate away.
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.