Use after free in Password Manager (CVE-2026-11049)
A use-after-free write exists in the PasswordGenerationAgent because a synchronous JavaScript callback can free the memory pointed to by a base::AutoReset. An attacker could trigger a 1-byte write of 0x00 to freed memory, potentially leading to exploitation.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
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 without the security team.
Overview: A potential Use-After-Free (UAF) write exists in PasswordGenerationAgent due to the unsafe use of base::AutoReset during password clearing. A synchronous JavaScript callback can force the reallocation of the tracked password item, freeing the memory pointed to by the AutoReset. Because AutoReset internally uses RAW_PTR_EXCLUSION, this bypasses MiraclePtr and results in an exploitable 1-byte write of 0x00 upon destruction.
Affected files:
components/autofill/content/renderer/password_generation_agent.ccbase/auto_reset.h
Estimated timestamp from git blame: 2022-08-01
Technical Details
A potential Use-After-Free (UAF) write vulnerability exists in the renderer process within components/autofill/content/renderer/password_generation_agent.cc.
In PasswordGenerationAgent::PasswordNoLongerGenerated, the agent clears a generated password and its related confirmation fields. To prevent false blur events during this process, it temporarily sets a boolean flag on the current_generation_item_ (which is a std::unique_ptr<GenerationItemInfo>) using base::AutoReset<bool>:
// components/autofill/content/renderer/password_generation_agent.cc
for (WebInputElement& element : current_generation_item_->password_elements_) {
base::AutoReset<bool> auto_reset_update_confirmation_password(
¤t_generation_item_->updating_other_password_fields_, true);
if (current_generation_item_->generation_element_ != element)
element.SetAutofillValue(blink::WebString());
}
The vulnerability occurs because element.SetAutofillValue() modifies the DOM directly and synchronously dispatches input and change events (and a focus event if the element wasn't focused). A malicious webpage can use a synchronous event listener on the confirmation field to execute JavaScript before the AutoReset goes out of scope.
If the attacker's script calls showPicker() on a different password generation field, it synchronously routes to AutofillAgent::OpenTextDataListChooser -> ShowSuggestions() -> PasswordGenerationAgent::ShowPasswordGenerationSuggestions() -> MaybeCreateCurrentGenerationItem().
Inside MaybeCreateCurrentGenerationItem(), a new GenerationItemInfo struct is created via std::make_unique and assigned to current_generation_item_. This reassignment deletes the old GenerationItemInfo object, freeing its memory back to PartitionAlloc.
When execution returns to PasswordNoLongerGenerated and the loop iteration ends, the AutoReset destructor runs. It attempts to restore the original boolean value (false, or 0x00) to the address it stored. Crucially, base::AutoReset::scoped_variable_ is explicitly marked with RAW_PTR_EXCLUSION in base/auto_reset.h, meaning it is not protected by MiraclePtr (BackupRefPtr). This results in a reliable 1-byte 0x00 write at a fixed offset within a freed memory chunk.
Potential Attacker Steps
Note: These are suggested steps to trigger the vulnerability based on code analysis; our tooling agent does not yet have the ability to run code to provide a working Proof of Concept.
- The attacker hosts a page with two password-generation-enabled forms: Form A (fields
#genA,#confA) and Form B (field#genB). - The user interacts with the page, granting transient user activation (e.g., via a click).
- Password generation is triggered and accepted on
#genA, populatingcurrent_generation_item_. - The user clicks anywhere on the page, and the attacker's
mousedownlistener synchronously callsgenA.focus()followed bydocument.execCommand("delete"). - The
deletecommand clears#genA, which synchronously callsPasswordNoLongerGenerated(). PasswordNoLongerGeneratedsets theAutoReseton#confA's loop iteration and callsSetAutofillValue("")on#confA.SetAutofillValuedispatches aninputevent to#confA.- The attacker's
inputevent listener synchronously callsgenB.showPicker(). (This uses the transient user activation from the initial click). showPicker()synchronously triggersMaybeCreateCurrentGenerationItem()for#genB, replacing and freeing the originalcurrent_generation_item_.- The
inputlistener finishes,SetAutofillValuereturns, and theAutoResetobject goes out of scope, writing 0x00 to the freed memory chunk.
Suggested Fix
Avoid using base::AutoReset on members of objects whose lifetimes can be invalidated by synchronous DOM events or JavaScript execution.
Instead of tying the updating_other_password_fields_ flag to the GenerationItemInfo struct, move this state to the PasswordGenerationAgent class itself, or use a custom scope guard that checks if current_generation_item_ still exists (and represents the same form/element, e.g., via a unique ID or base::WeakPtr check) before attempting to revert the flag.
Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33
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 uses base::AutoReset on a member of an object that can be freed by synchronous DOM events, and because AutoReset uses RAW_PTR_EXCLUSION it bypasses MiraclePtr protection.
Impact
An attacker could potentially exploit a 1-byte write of 0x00 to freed memory, though the report does not demonstrate full exploitation.
What the attacker needed
Victim visits attacker page; victim interacts to grant user activation; password generation accepted
The fix
The fix should avoid using base::AutoReset on members of objects whose lifetimes can be invalidated by synchronous DOM events, for example by moving the flag to the agent class or using a scope guard that checks the object still exists.
How it was found
- The attacker hosts a page with two password-generation-enabled forms.
- The user interacts with the page, granting transient user activation.
- Password generation is triggered and accepted on the first form.
- The user clicks, and the attacker's mousedown listener focuses the generation field and deletes its content.
- The delete command clears the field, calling PasswordNoLongerGenerated().
- The attacker's input event listener calls showPicker() on the second form, freeing the original generation item.
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 happens when a program keeps a pointer to memory it has already freed, and then writes to it. Here, a JavaScript event can cause the password manager to free an object while a temporary flag still points to it, so when the flag is cleaned up it writes to freed memory. This could let an attacker corrupt memory, though the report only shows a small one-byte write.
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.