Use after free in Autofill (CVE-2026-15113)
A use-after-free in the Android browser process occurs because a final JNI pointer in AutofillNameFixFlowBridge is never cleared after the native CardNameFixFlowViewAndroid object is deleted. A queued IME action on a detached EditText can invoke native methods on the stale pointer, potentially leading to control-flow hijacking and remote code execution in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 34 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. 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 (UAF) vulnerability in the Android browser process occurs when CardNameFixFlowViewAndroid is deleted but its final JNI pointer remains in AutofillNameFixFlowBridge. A queued IME action or event on the detached EditText can invoke native methods on this stale pointer, potentially leading to control-flow hijacking. The vulnerability is caused by the JNI pointer being declared 'final' and never cleared upon prompt dismissal.
Affected files:
chrome/browser/ui/android/autofill/card_name_fix_flow_view_android.ccchrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillNameFixFlowBridge.javachrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillNameFixFlowPrompt.java
Estimated timestamp from git blame: 2018-11-08
Potential Use-After-Free in CardNameFixFlowViewAndroid via Stale JNI Pointer and IME Action Bypass
1. Code Defect Analysis
In chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillNameFixFlowBridge.java (line 28), the native pointer reference is declared as:
private final long mNativeCardNameFixFlowViewAndroid;
Because this field is marked final, it cannot be modified or zeroed out once initialized. When onPromptDismissed() (line 76-78) calls the native PromptDismissed() JNI method, the native object executes delete this (chrome/browser/ui/android/autofill/card_name_fix_flow_view_android.cc:37), freeing the native memory chunk. However, the Java AutofillNameFixFlowBridge instance remains alive on the Java heap and continues to hold the stale pointer.
In contrast, other similar JNI implementations such as AutofillExpirationDateFixFlowBridge.java (line 27) declare the native reference as mutable and correctly clear it upon dismissal:
private long mNativeCardExpirationDateFixFlowViewAndroid;
...
@Override
public void onPromptDismissed() {
AutofillExpirationDateFixFlowBridgeJni.get()
.promptDismissed(mNativeCardExpirationDateFixFlowViewAndroid);
mNativeCardExpirationDateFixFlowViewAndroid = 0;
}
2. Potential Teardown & Race Flow
When a tab containing a payment prompt is closed (e.g., via a compromised renderer), the following synchronous teardown chain is initiated:
~ChromePaymentsAutofillClient->~CardNameFixFlowControllerImpl()->MaybeDestroyCardNameFixFlowView(true)CardNameFixFlowViewAndroid::ControllerGone()sets itscontroller_pointer tonullptrand calls the Java bridge'sdismiss()method.- In Java,
mNameFixFlowPrompt.dismiss(DialogDismissalCause.DISMISSED_BY_NATIVE)executes. ModalDialogManager.dismissDialogtriggersonDismiss()on the prompt's controller, which calls the bridge'sonPromptDismissed().- JNI
promptDismissed()is called withmNativeCardNameFixFlowViewAndroid. - Native
CardNameFixFlowViewAndroid::PromptDismissedexecutesdelete this, freeing the C++ object. AppModalPresenter.javadetaches themDialogViewandEditText.
Although the view is detached, Garbage Collection in Android is asynchronous, meaning the Java objects and listeners remain in memory. If an IME_ACTION_DONE event is already queued in the UI thread's Looper behind the close-tab task, the editor action listener on the detached EditText can be executed:
mUserNameInput.setOnEditorActionListener(
(view, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE) {
if (mUserNameInput.getText().toString().trim().length() != 0) {
onClick(mDialogModel, ModalDialogProperties.ButtonType.POSITIVE);
}
return true;
}
return false;
});
This listener calls onClick(mDialogModel, POSITIVE) directly, which bypasses the ModalDialogManager state checks and calls mDelegate.onUserAcceptCardholderName(...). This method immediately invokes JNI onUserAccept with the stale, non-zeroed mNativeCardNameFixFlowViewAndroid pointer:
@Override
public void onUserAcceptCardholderName(String name) {
AutofillNameFixFlowBridgeJni.get().onUserAccept(mNativeCardNameFixFlowViewAndroid, name);
}
3. Security Impact
On the native side, the JNI zero-generated wrapper performs a raw reinterpret_cast on the stale pointer and invokes OnUserAccept(). This method dereferences this->controller_ (chrome/browser/ui/android/autofill/card_name_fix_flow_view_android.cc:29):
void CardNameFixFlowViewAndroid::OnUserAccept(JNIEnv* env,
const std::u16string& name) {
controller_->OnNameAccepted(name);
}
If the freed memory of CardNameFixFlowViewAndroid has been reclaimed or sprayed in the browser process, controller_ will contain attacker-controlled bytes. Because CardNameFixFlowController is an abstract interface, calling OnNameAccepted triggers an indirect virtual function call based on a controlled vtable, leading to arbitrary Remote Code Execution (RCE) in the privileged, unsandboxed browser process (complete Sandbox Escape).
4. Potential Steps to Reproduce
Note: These are theoretical steps as our tooling lacks the capability to execute code.
- A compromised renderer opens a popup window and navigates it to an attacker page hosting a credit-card form lacking a cardholder-name field.
- The renderer auto-submits the form to trigger the upload-save offer dialog.
- The user interacts with the dialog, typing a cardholder name and tapping the IME 'Done' key (queues
IME_ACTION_DONEin the UI thread's Looper). - The renderer immediately sends a
window.close()IPC, placing the tab teardown task in the queue ahead of the IME event. - Tab teardown executes, synchronously deleting the native
CardNameFixFlowViewAndroidobject. - The renderer sprays the browser-process heap to reclaim the freed view memory chunk.
- The Looper processes the queued
IME_ACTION_DONEevent, dispatching it to the detachedEditText. - The listener triggers the JNI call with the stale
finalpointer, dereferencing the sprayed memory and executing the hijacked virtual call.
5. Suggested Fix
Modify chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillNameFixFlowBridge.java to:
- Remove the
finalmodifier frommNativeCardNameFixFlowViewAndroid. - Clear the pointer to
0inside theonPromptDismissed()callback. - Ensure that all JNI invocations (
onUserDismiss,onUserAcceptCardholderName, etc.) perform a null/zero check onmNativeCardNameFixFlowViewAndroidbefore calling the JNI methods.
Evaluated with Chrome root at commit: e9507a33bb4148ee071aaaf8a7e9ad68770359bf
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
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 JNI pointer field is declared final and never zeroed after the native object is deleted, leaving a stale reference that can be used by queued events.
Impact
If the freed memory is reclaimed or sprayed, an attacker could achieve arbitrary remote code execution in the privileged, unsandboxed browser process, leading to a complete sandbox escape.
What the attacker needed
Compromised renderer; user interaction with dialog; timing of queued events
The fix
The fix should remove the final modifier, clear the pointer to zero in onPromptDismissed, and add null checks before all JNI invocations.
How it was found
- A compromised renderer opens a popup and navigates to an attacker page with a credit-card form lacking a cardholder-name field.
- The renderer auto-submits the form to trigger the upload-save offer dialog.
- The user types a cardholder name and taps the IME 'Done' key, queuing an IME_ACTION_DONE event.
- The renderer sends a window.close() IPC, placing tab teardown ahead of the IME event in the queue.
- Tab teardown executes, synchronously deleting the native CardNameFixFlowViewAndroid object.
- The renderer sprays the browser-process heap to reclaim the freed memory chunk.
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.
When a payment prompt is dismissed, the native part of the code is deleted, but the Java part keeps a reference to it. If a keyboard action arrives later, the Java code tries to use the deleted native object, which can crash or let an attacker take control. This is called a use-after-free because memory is used after it has been freed.
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.