Use after free in Web Authentication (CVE-2026-13029)
A use-after-free in Chrome's WebAuthn cleanup path could occur when a WebAuthn dialog is closed inside an extension popup, because closing the dialog synchronously destroys the object that is still executing cleanup code. An attacker could potentially trigger a write and read on freed memory in the browser process, though the report only describes a potential issue from code analysis.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 16 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: AuthenticatorCommonImpl::Cleanup() synchronously resets the request state, which triggers WebAuthn modal dialog widget destruction. Under specific conditions, such as the page being hosted in an extension popup, widget closure synchronously destroys the hosting WebContents and the AuthenticatorCommonImpl instance itself. This leads to a potential Use-After-Free (UAF) write and read when Cleanup() subsequently increments and checks next_request_key_.
Affected files:
content/browser/webauth/authenticator_common_impl.cccontent/browser/webauth/authenticator_common_impl.h
Estimated timestamp from git blame: 2024-08-06
Location
content/browser/webauth/authenticator_common_impl.cc:3223-3229content/browser/webauth/authenticator_common_impl.h
Root Cause Analysis
AuthenticatorCommonImpl::Cleanup() performs req_state_.reset() to tear down request-specific state. However, resetting this state can synchronously close UI dialogs/widgets. Under certain environments (like an extension popup), closing the UI shifts focus/activation, triggering a chain that synchronously destroys the hosting WebContents, the Mojo DocumentService AuthenticatorImpl, and AuthenticatorCommonImpl itself.
Since Cleanup() accesses this immediately after the reset without any liveness guards, this leads to a potential browser-process Use-After-Free (UAF) write (next_request_key_++) and read (CHECK(next_request_key_)):
// content/browser/webauth/authenticator_common_impl.cc:3223-3229
void AuthenticatorCommonImpl::Cleanup() {
CHECK(!req_state_ || req_state_->request_key.value() == next_request_key_);
req_state_.reset(); // <--- Synchronous widget teardown and self-destruction
next_request_key_++; // <--- UAF Write to next_request_key_ on freed heap
CHECK(next_request_key_); // <--- UAF Read from freed heap
}
next_request_key_ is a plain uint64_t member (defined in authenticator_common_impl.h:384), meaning it is not protected by MiraclePtr.
Potential Destruction Sequence
req_state_.reset()deletes theRequestStatestructure.- Deleting
RequestStatedestroys its memberstd::unique_ptr<AuthenticatorRequestClientDelegate> request_delegate. - In Chrome, this invokes
~ChromeAuthenticatorRequestDelegate(), which callsdialog_model_->OnRequestComplete()(defined inchrome/browser/webauthn/chrome_authenticator_request_delegate.cc:290). - Observers are notified, and
AuthenticatorRequestDialogController::OnRequestComplete()transitions the current step toStep::kClosed. AuthenticatorRequestDialogModel::SetStep()sees thatkClosedhas no dialog UI type, and executesview_controller_.reset()(defined inauthenticator_request_dialog_model.cc:167).- The view controller's default destructor destroys
std::unique_ptr<views::Widget> widget_, invokingviews::Widget::~Widget()(defined inui/views/widget/widget.cc:295). - Since the widget has
CLIENT_OWNS_WIDGETownership, the destructor removes the dialog from theWebContentsModalDialogManagerviaWillClose()and callsnative_widget_->Close(). - The native widget closure shifts native window activation back to the browser window.
- This activation change is observed by the parent tree, triggering
ExtensionPopup::OnWidgetTreeActivated()on the extension popup (defined inchrome/browser/ui/views/extensions/extension_popup.cc:152). - Since the WebAuthn dialog was already removed from the modal manager, the popup checks
web_modal::WebContentsHasActiveWebModal()which returns false, leading to the popup closing itself viaCloseDeferredIfNecessary(). - Popup closure synchronously destroys its
WebContentsand the frame-bound MojoDocumentServiceAuthenticatorImplcontaining theAuthenticatorCommonImplinstance, freeing its heap memory. - The call stack unwinds back to
Cleanup(), which attempts to executenext_request_key_++on the freedthisobject.
Suggested / Potential Reproduction Steps
(Note: These are potential steps based on code analysis; our tooling agent does not yet have the capability to execute code or verify the exact platform-specific activation timing.)
- Load an extension popup page that initiates a WebAuthn registration or assertion request (via
navigator.credentials.create/navigator.credentials.get). - While the WebAuthn modal dialog is active, complete or abort the request (e.g., via user cancellation or programmatic abort).
- Observe if the destruction of the widget shifts focus and synchronously tears down the
WebContentscontainer and theAuthenticatorCommonImplinstance before theCleanup()call stack unwinds.
Suggested Fix
Guard the post-reset instructions inside AuthenticatorCommonImpl::Cleanup() with a WeakPtr liveness check, similarly to how identical patterns were resolved in the sibling Digital Credentials implementation:
void AuthenticatorCommonImpl::Cleanup() {
CHECK(!req_state_ || req_state_->request_key.value() == next_request_key_);
base::WeakPtr<AuthenticatorCommonImpl> weak_this = weak_factory_.GetWeakPtr();
req_state_.reset();
if (!weak_this) {
return;
}
next_request_key_++;
CHECK(next_request_key_);
}
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, Cleanup() resets request state that synchronously destroys the hosting WebContents and the AuthenticatorCommonImpl instance itself, then accesses its own member variables without a liveness check.
Impact
A browser-process use-after-free write and read could occur, potentially leading to memory corruption or a crash, but the report only describes a potential issue and does not demonstrate exploitation.
What the attacker needed
Chrome browser; extension popup hosting the page; WebAuthn request initiated; request completed or aborted
The fix
The post-reset instructions in Cleanup() should be guarded with a WeakPtr liveness check, as done in the sibling Digital Credentials implementation.
How it was found
- Load an extension popup page that starts a WebAuthn registration or assertion request.
- While the WebAuthn dialog is active, complete or abort the request.
- Observe whether widget destruction shifts focus and tears down the WebContents and AuthenticatorCommonImpl before Cleanup() returns.
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 website asks you to use a security key or passkey, Chrome shows a dialog. The code that closes that dialog can, in a rare case, also delete the object that is still running the closing code. That means the program later reads and writes memory that has already been freed, which can crash the browser or, in theory, be abused.
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.