Insufficient data validation in Passwords (CVE-2026-14009)
A use-after-free was identified in Chrome's password autofill code, where a synchronous DOM event dispatched during field filling can run page script that detaches the iframe and enters a nested run loop, destroying the agent object while its method is still on the stack. An attacker could potentially exploit this to access freed memory, though the report notes no working proof-of-concept was built.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 36 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 exists in PasswordAutofillAgent due to synchronous DOM events dispatched inside DoFillField. By triggering a nested run loop (via window.print()) during a synchronous event listener and subsequently detaching the iframe, the PasswordAutofillAgent object can be destroyed while its methods remain on the call stack. Upon exiting the nested run loop, execution resumes inside a freed this context, leading to a Use-After-Free.
Affected files:
components/autofill/content/renderer/password_autofill_agent.cccomponents/autofill/content/renderer/password_autofill_agent.h
Estimated timestamp from git blame: 2024-02-27
Bug Analysis & Root Cause
In components/autofill/content/renderer/password_autofill_agent.cc, the function PasswordAutofillAgent::DoFillField is responsible for autofilling credentials into DOM input fields:
void PasswordAutofillAgent::DoFillField(WebInputElement input,
const std::u16string& credential,
FieldPropertiesMask field_properties) {
CHECK(input);
input.SetAutofillValue(WebString::FromUtf16(credential)); // <--- Synchronous DOM Event Dispatch
field_data_manager().UpdateFieldDataMap(...); // <--- Use-After-Free
...
TrackAutofilledElement(input);
}
Calling input.SetAutofillValue() triggers Blink to update the input's value and synchronously dispatch input and change DOM events. A malicious page can register a synchronous event listener on the input field. When this listener is invoked, it can initiate frame teardown and immediately enter a nested run loop by invoking window.print().
Potential Exploitation Mechanism
An attacker could potentially trigger the Use-After-Free using the following sequence of events:
- A parent document (Origin A) embeds a cross-origin login iframe (Origin B).
- Origin B registers a synchronous
changeevent listener on its username input element. - The user interacts with the iframe and triggers Chrome's password autofill.
PasswordAutofillAgent::DoFillFieldis called, which callsinput.SetAutofillValue(...).- Blink synchronously dispatches the
changeevent, executing the page's event listener in Origin B. - The event listener calls
window.parent.postMessage('detach', '*')and immediately invokeswindow.print(). window.print()entersPrintRenderFrameHelper::ScriptedPrintand spins a nested message loop with nestable tasks allowed (base::RunLoop::Type::kNestableTasksAllowed).- The parent frame receives the postMessage and removes the iframe from the DOM.
- The browser process sends a
mojom::Frame::DeleteIPC to the child renderer, which is processed immediately within the nested run loop. RenderFrameImpl::Deletedetaches the frame, invokingOnDestruct()onAutofillAgent. This posts aDeleteSoontask to the default queue, which executes immediately inside the nested run loop.- When
AutofillAgentis destroyed, its ownedPasswordAutofillAgentis also destroyed. - Due to class-member destruction order in
AutofillAgent,FormTrackeris destroyed beforePasswordAutofillAgent, releasing anyraw_reforraw_ptrreferences to it and dropping the BackupRefPtr reference count to 0. This bypasses the BackupRefPtr quarantine, deallocating the memory immediately. - Once the print dialog is dismissed and the nested loop terminates, execution unwinds back to
DoFillField. - The call to
field_data_manager()is made on a freedthispointer, resulting in a Use-After-Free.
Note: Our tooling does not currently have the capability to run code or compile a working proof-of-concept, so these steps represent a potential and theoretical attack vector based on static code path analysis.
Suggested Remediation
To prevent this issue, PasswordAutofillAgent should be tracked using a base::WeakPtr to verify liveness after returning from operations that execute arbitrary page JavaScript. Alternatively, avoid calling field_data_manager() or making member accesses on this after SetAutofillValue without verifying if the frame observer or agent is still valid, or leverage a weak pointer pattern like base::WeakPtrFactory in PasswordAutofillAgent to exit gracefully if this has been destroyed.
Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8
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 code calls a function that synchronously dispatches DOM events, allowing page script to destroy the object before the method finishes using its members.
Impact
An attacker could potentially cause a use-after-free, which may lead to memory corruption or code execution, but the report states no working proof-of-concept was built.
What the attacker needed
Victim uses Chrome password autofill; attacker controls a cross-origin iframe; user interaction with the iframe
The fix
The agent should be tracked with a weak pointer to check liveness after operations that run page JavaScript, or member accesses after SetAutofillValue should be avoided without verifying validity.
How it was found
- A parent document embeds a cross-origin login iframe.
- The iframe registers a synchronous change event listener on its username input.
- The user triggers Chrome's password autofill in the iframe.
- The event listener posts a message to the parent and calls window.print(), entering a nested run loop.
- The parent removes the iframe, causing the agent object to be destroyed inside the nested loop.
- After the print dialog closes, execution returns to the freed object, causing a use-after-free.
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 fills in a password field, the browser runs some code that can trigger events on the page. A malicious page can use those events to make the browser close the part of the page that owns that code while it is still running. This leaves the code using memory that has already been freed, which is called a use-after-free and can sometimes let an attacker 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.