Use after free in Permissions (CVE-2026-6315)
A use-after-free vulnerability exists in Android permission prompt logic where a synchronous JNI call can trigger immediate dismissal, destroying the underlying C++ delegate object while its method is still on the stack. An attacker could potentially exploit this to hijack control flow and achieve remote code execution in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 13 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 potential Use-After-Free (UAF) vulnerability exists in the Android permission prompt logic. A synchronous JNI call during dialog creation can trigger immediate dismissal, destroying the underlying C++ delegate object while its method is still on the stack. Returning from JNI results in a UAF when accessing member variables.
Affected files:
components/permissions/android/permission_prompt/permission_dialog_delegate.cccomponents/permissions/android/permission_prompt/permission_dialog_delegate.hcomponents/permissions/android/java/src/org/chromium/components/permissions/PermissionDialogController.javacomponents/permissions/android/java/src/org/chromium/components/permissions/PermissionDialogDelegate.javacomponents/permissions/android/java/src/org/chromium/components/permissions/PermissionDialogCoordinator.java
Estimated timestamp from git blame: 2026-01-16
Summary
A potential Use-After-Free (UAF) exists in PermissionDialogJavaDelegate::CreateDialog on Android. When initializing a permission prompt, a synchronous JNI call is made to Java to show the dialog. If the Java side immediately dismisses the dialog (e.g., due to a null ModalDialogManager), a synchronous callback to native code destroys the PermissionDialogJavaDelegate object. When execution unwinds back to CreateDialog, the this pointer is dangling, leading to a UAF and a potential control flow hijack.
Technical Details
The vulnerability is triggered during the creation of a permission prompt via PermissionRequestManager::RecreateView(). This function invokes a factory method that eventually calls the PermissionDialogDelegate constructor, which allocates a PermissionDialogJavaDelegate using a std::unique_ptr and calls CreateDialog() on it.
In components/permissions/android/permission_prompt/permission_dialog_delegate.cc:
void PermissionDialogJavaDelegate::CreateDialog(content::WebContents* web_contents) {
// ...
PermissionDialogController::CreateDialog(env, j_delegate_); // Synchronous JNI call
if (permission_prompt_->ShouldUseRequestingOriginFavicon()) { // UAF occurs here
// ...
}
}
- JNI Execution: The code calls
PermissionDialogController::CreateDialogin Java. - Synchronous Dismissal: In Java, if
PermissionDialogCoordinator.showDialogdetermines that theModalDialogManageris null (which can happen in certain embedders like WebEngine where layout isn't inflated, or during navigation/backgrounding races), it immediately callsonDismiss(DismissalType.AUTODISMISS_NO_DIALOG_MANAGER). - Native Re-entry: The
onDismisscall synchronously invokes the native methodPermissionDialogDelegate::Dismissed(). - Destruction: Inside
Dismissed(), the code checksif (!permission_prompt_->IsShowing()). Because the prompt factory has not yet returned,PermissionRequestManagerhas not assigned the new prompt to itsview_member. Therefore,IsShowing()evaluates tofalse, and the code callsDestroyJavaDelegate(), which callsjava_delegate_.reset(). - Use-After-Free: The
reset()completely frees thePermissionDialogJavaDelegateobject. The stack unwinds back toPermissionDialogJavaDelegate::CreateDialog(). The code proceeds to dereferencepermission_prompt_from the now-deletedthisobject.
Note on MiraclePtr (BackupRefPtr): MiraclePtr does not mitigate this issue. The object being freed is the PermissionDialogJavaDelegate itself, which is owned by a std::unique_ptr and accessed via the raw C++ this pointer. Because there are no raw_ptrs pointing to the PermissionDialogJavaDelegate object, PartitionAlloc frees the memory immediately without quarantining or zapping it. The subsequent read of permission_prompt_ reads from freed, potentially reallocated memory.
Potential Exploitation Steps
An attacker could potentially exploit this with the following steps:
- Trigger a permission request (e.g.,
navigator.permissions.request({name: 'geolocation'})) on an Android device. - Race the prompt creation with an action that invalidates the
WindowAndroidorModalDialogManager(e.g., navigating away, backgrounding the tab), or target an embedder where this is deterministically null. - During the synchronous
permission_prompt_->Dismiss()cascade triggered byDestroyJavaDelegate(), use the extensive observer notifications to spray the heap and reallocate the freedPermissionDialogJavaDelegatechunk with attacker-controlled bytes. - When execution returns to
CreateDialog(), the virtual methodShouldUseRequestingOriginFavicon()is called on the attacker's fake object. - The attacker controls the vtable, successfully hijacking execution flow to achieve Remote Code Execution (RCE) in the browser process.
Note: Our tooling agent does not have the capability to run code or provide a working PoC, so these steps are theoretical.
Suggested Fix
Do not synchronously destroy the Java delegate while it might be on the stack.
One approach is to have PermissionDialogDelegate::Dismissed() post the destruction of the java_delegate_ to the message loop (e.g., using base::SequencedTaskRunner::GetCurrentDefault()->DeleteSoon()), ensuring it is only destroyed after the current stack unwinds.
Alternatively, PermissionDialogJavaDelegate::CreateDialog could check a weak pointer to itself after the JNI call returns, or the JNI call could be made asynchronous so it does not block and re-enter synchronously.
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
The code synchronously destroys the Java delegate object during a JNI call, leaving a dangling pointer that is later dereferenced.
Impact
An attacker could potentially hijack control flow and achieve remote code execution in the browser process, though the exploitation steps are theoretical and not demonstrated.
What the attacker needed
Android device; Permission request triggered; Race condition or specific embedder
The fix
The fix should avoid synchronously destroying the Java delegate while it might be on the stack, for example by posting the destruction to the message loop or using a weak pointer check.
How it was found
- Trigger a permission request on an Android device.
- Race the prompt creation with an action that invalidates the WindowAndroid or ModalDialogManager.
- During the synchronous dismissal cascade, spray the heap to reallocate the freed object with attacker-controlled bytes.
- When execution returns, the virtual method call uses the attacker's fake object, hijacking control flow.
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 frees memory but then keeps using it, like deleting a file and then trying to open it. Here, a permission dialog on Android can be closed immediately during its creation, which frees the object that is still being used, potentially letting an attacker take control of the program.
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.