Use after free in Browser (CVE-2026-9884)
A use-after-free vulnerability exists in DeviceAuthenticatorMac on macOS when falling back to synchronous password authentication. An attacker could potentially trigger frame destruction during the blocking OS dialog, freeing the object, and then reclaim the memory to execute arbitrary code in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 28 days
Flapjack, 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 Chrome Security team. 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 exists in DeviceAuthenticatorMac when falling back to synchronous system password authentication on macOS. The blocking OS call spins a nested event loop, allowing IPCs to destroy the authenticator instance while its this pointer is already cached on the stack. When the call returns, execution continues using the dangling pointer, potentially leading to arbitrary code execution in the browser process.
Affected files:
chrome/browser/device_reauth/mac/device_authenticator_mac.mmchrome/browser/device_reauth/mac/authenticator_mac.mmchrome/browser/password_manager/password_manager_util_mac.mm
Estimated timestamp from git blame: 2023-03-03
Summary
A potential Use-After-Free (UAF) vulnerability exists in DeviceAuthenticatorMac::AuthenticateWithMessage on macOS. When biometric authentication is unavailable, the code falls back to a synchronous OS password prompt. This system call spins a nested macOS event loop, allowing Chromium's main thread to continue processing IPC messages. If a malicious page triggers frame destruction (e.g., via window.close()) while the prompt is active, the DeviceAuthenticatorMac instance is freed. Upon the prompt's dismissal, the browser resumes execution using a cached, dangling this pointer, which can be leveraged for Arbitrary Code Execution (ACE) in the browser process.
Technical Details
In chrome/browser/device_reauth/mac/device_authenticator_mac.mm, the AuthenticateWithMessage function handles device re-authentication. If Touch ID is unavailable, it performs a synchronous fallback:
if (!CanAuthenticateWithBiometrics()) {
OnAuthenticationCompleted(authenticator_->AuthenticateUserWithNonBiometrics(
l10n_util::GetStringFUTF16(IDS_PASSWORDS_AUTHENTICATION_PROMPT_PREFIX,
message)));
return;
}
- Evaluation Order: Under C++17 evaluation rules for member function calls (
E1.E2(E3)), the postfix-expression (thethispointer forOnAuthenticationCompleted) is evaluated and cached in a register or on the stack before the argument expression (authenticator_->...) is evaluated. - Blocking Call & Nested Loop:
AuthenticateUserWithNonBiometricseventually invokesAuthorizationCopyRightsviapassword_manager_util_mac::AuthenticateUser. This is a blocking macOS system API that displays a modal password dialog. To keep the application responsive, it spins a nestedCFRunLoop. Because Chromium'sMessagePumpCFRunLoopis registered tokCFRunLoopCommonModes, it continues to pump tasks and Mojo IPCs from renderers while the dialog is visible. - Object Destruction: If the renderer sends an IPC that destroys the
WebContents(e.g., a timer firingwindow.close()), the destruction is processed synchronously during the nested loop. This destroys theContentPasswordManagerDriverFactory, theContentPasswordManagerDriver, thePasswordAutofillManager, and ultimately theDeviceAuthenticatorMacinstance. The backing memory is freed. - Use-After-Free: When the user dismisses the system dialog,
AuthorizationCopyRightsreturns. Execution resumes inAuthenticateWithMessage, which uses the previously cached (and now dangling)thispointer to callOnAuthenticationCompleted.
Inside OnAuthenticationCompleted, a write occurs (touch_id_auth_context_ = nullptr;), followed by a read and execution of a base::OnceCallback (std::move(callback_).Run(success);). Because the implicit this pointer is held on the stack during the call, it is not protected by MiraclePtr (BackupRefPtr). An attacker who reclaims the freed memory via heap spraying can forge the callback_ member, leading to Arbitrary Code Execution in the browser process.
Potential Reproduction Steps
Note: Our tooling agent cannot execute code, so these are suggested steps based on static analysis.
- On a macOS device where Touch ID is disabled or unavailable, an attacker hosts a malicious page with a password field.
- The attacker's JavaScript sets a
setTimeoutto callwindow.close()after a brief delay. - The user interacts with the password field and selects a saved credential, triggering an Autofill re-authentication request to the browser process.
- The browser invokes
DeviceAuthenticatorMac::AuthenticateWithMessage, bringing up the blocking OS password dialog. - While the dialog is visible, the
setTimeoutfires, sending thewindow.close()IPC to the browser. - The browser processes the IPC in the nested
CFRunLoop, destroying the frame and freeing theDeviceAuthenticatorMacobject. - The attacker's JavaScript (e.g., from another open window or a Web Worker) performs heap spraying to reclaim the freed memory with a forged
base::OnceCallback. - The user clicks "Cancel" on the OS password prompt.
- The system call returns, and the browser executes the hijacked callback, achieving code execution.
Suggested Fix
Do not call OnAuthenticationCompleted directly using the implicit this pointer inline with the synchronous blocking call. Instead, evaluate the result first, and use a base::WeakPtr to safely check if the object survived the nested run loop before proceeding.
if (!CanAuthenticateWithBiometrics()) {
base::WeakPtr<DeviceAuthenticatorMac> weak_this = weak_ptr_factory_.GetWeakPtr();
bool success = authenticator_->AuthenticateUserWithNonBiometrics(
l10n_util::GetStringFUTF16(IDS_PASSWORDS_AUTHENTICATION_PROMPT_PREFIX,
message));
if (weak_this) {
weak_this->OnAuthenticationCompleted(success);
}
return;
}
Evaluated with Chrome root at commit: cc901875d53bf4e4fe0e01f02843871da4106e70
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 code caches the `this` pointer before a blocking call that spins a nested event loop, allowing the object to be destroyed and then used after free.
Impact
An attacker could potentially achieve arbitrary code execution in the browser process, but this requires specific conditions such as Touch ID being unavailable and successful heap spraying.
What the attacker needed
MacOS device without Touch ID; user selects saved credential; attacker can run JavaScript; heap spraying capability
The fix
The code should evaluate the result first and use a base::WeakPtr to safely check if the object survived the nested run loop before calling OnAuthenticationCompleted.
How it was found
- On a macOS device without Touch ID, the attacker hosts a page with a password field.
- The attacker's JavaScript sets a timer to call window.close() after a delay.
- The user selects a saved credential, triggering an Autofill re-authentication request.
- The browser shows a blocking OS password dialog.
- While the dialog is visible, the timer fires and sends a window.close() IPC.
- The browser processes the IPC in the nested event loop, destroying the frame and freeing the authenticator object.
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 keeps using memory after it has been freed. Here, a password prompt blocks the browser, and during that time a malicious page can close the window, causing the object to be freed. When the prompt closes, the browser uses the freed memory, which an attacker could control to run their own code.
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.