Use after free in Passwords (CVE-2026-12442)
A re-entrancy issue during the destruction of TouchToFillController on Android can cause a use-after-destruction of its visibility controller weak pointer, potentially leading to a use-after-free and a controlled virtual function call in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 8 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 re-entrancy issue during the destruction of TouchToFillController on Android can trigger a Use-After-Destruction of its visibility controller weak pointer. This occurs because the owned delegate synchronously fires its cancellation callback during its own destruction, re-entering the parent controller. This can potentially lead to a Use-After-Free (UAF) and a controlled virtual function call in the unsandboxed browser process.
Affected files:
chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.hchrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.ccchrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.cc
Estimated timestamp from git blame: 2023-07-12
Description
There is a potential re-entrancy vulnerability in the Android implementation of Touch-to-Fill (TTF). During the destruction of TouchToFillController, its member variables are destroyed in the reverse order of their declaration. Because the controller delegate (ttf_delegate_) is declared before the visibility controller weak pointer (visibility_controller_), the visibility controller is destroyed first, while the delegate is destroyed last.
When ttf_delegate_ is destroyed, its destructor ~TouchToFillControllerAutofillDelegate is invoked, which calls authenticator_->Cancel(). On Android, DeviceAuthenticatorAndroid::Cancel() synchronously executes any pending re-authentication callback with a failure status. This callback propagates back and synchronously runs TouchToFillController::ActionCompleted via a base::Unretained binding.
Re-entering ActionCompleted on a partially destructed TouchToFillController leads to a Use-After-Destruction of the visibility_controller_ member. Specifically, evaluating if (visibility_controller_) dereferences a freed WeakReference::Flag on the heap, and a subsequent call to SetShown() results in an indirect virtual call on an already freed KeyboardReplacingSurfaceVisibilityControllerImpl object inside the browser process.
Potential Attack Scenario
Note: These are suggested analytical steps as our tooling does not currently have the capability to run or verify proof-of-concept exploit code.
- An attacker prompts the user to focus a password field on an attacker-controlled page, triggering the Touch-to-Fill bottom sheet UI.
- The user selects a credential, which triggers a biometric authentication prompt via
DeviceAuthenticatorAndroid. - While the biometric prompt is visible, the attacker's page programmatically closes the window (e.g., via
window.close()), initiating aWebContentsteardown. - The teardown triggers the destruction of
ChromePasswordManagerClientandTouchToFillController. - During member destruction of
TouchToFillController,visibility_controller_is destructed first, freeing its underlying tracking flag. Next,ttf_delegate_is destroyed. - The delegate's destructor calls
Cancel(), synchronously invoking the failure callback which re-entersTouchToFillController::ActionCompleted. ActionCompletedperforms a Use-After-Destruction check onvisibility_controller_and attempts to callSetShown()on the freed visibility controller object.
Affected Files and Code References
chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.h:141-165(Member declaration order ensuresvisibility_controller_is destroyed beforettf_delegate_)chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.cc:317-322(ActionCompletedaccessesvisibility_controller_after its destruction)chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller_autofill_delegate.cc:101-107(Destructor synchronously cancels the authenticator)chrome/browser/device_reauth/android/device_authenticator_android.cc:136-147(Cancel()runs the callback synchronously)
Suggested Fix
To resolve this issue, avoid binding the ActionCompleted callback with base::Unretained(this). Instead, use a weak pointer from the controller's weak_ptr_factory_. Since weak_ptr_factory_ is destroyed first during the member destruction phase of TouchToFillController, any re-entrant execution of the callback during the destruction of the delegate will be safely ignored as the weak pointer will already be invalidated.
// chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.cc:209-212
ttf_delegate_->OnCredentialSelected(
credential, base::BindOnce(&TouchToFillController::ActionCompleted,
weak_ptr_factory_.GetWeakPtr()));
Evaluated with Chrome root at commit: 3947e01999a53d4e2382e39736cb79d79c7dffcf
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
Likely the delegate's destructor synchronously invokes a callback that re-enters the parent controller after the visibility controller member has already been destroyed, due to member declaration order and use of base::Unretained.
Impact
This could potentially lead to a use-after-free and a controlled virtual function call in the unsandboxed browser process.
What the attacker needed
Android device; attacker-controlled page; user selects a credential; biometric prompt appears
The fix
The issue should be fixed by avoiding base::Unretained and instead binding the callback with a weak pointer from the controller's weak_ptr_factory_.
How it was found
- An attacker prompts the user to focus a password field on an attacker-controlled page, triggering the Touch-to-Fill bottom sheet UI.
- The user selects a credential, which triggers a biometric authentication prompt via DeviceAuthenticatorAndroid.
- While the biometric prompt is visible, the attacker's page programmatically closes the window (e.g., via window.close()), initiating a WebContents teardown.
- The teardown triggers the destruction of ChromePasswordManagerClient and TouchToFillController.
- During member destruction of TouchToFillController, visibility_controller_ is destructed first, freeing its underlying tracking flag. Next, ttf_delegate_ is destroyed.
- The delegate's destructor calls Cancel(), synchronously invoking the failure callback which re-enters TouchToFillController::ActionCompleted.
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 program frees an object but later uses it again, that is a use-after-free. Here, during cleanup, a callback runs and touches an object that has already been freed, which could let an attacker run their own code in the browser.
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.