Use after free in Autofill (CVE-2024-7968)
A static-analysis review found that the password-generation popup controller calls a driver method that can destroy the controller object, then uses the object again afterwards. If confirmed, an attacker could potentially trigger a use-after-free in the browser, though no proof of concept exists.
- Fix shipped in 3 months
Steps to reproduce the problem
- The bug was found by static analysis, so there is no poc yet. However, the prior fix in 079002c2a37d156e88065bb58cecfad9597d7818 suggests that it might be a UAF. So, I'm asking for your manual intervention. Thanks for the time!
Problem Description
// src/chrome/browser/ui/passwords/password_generation_popup_controller_impl.cc
void PasswordGenerationPopupControllerImpl::PasswordAccepted() {
// ...
base::WeakPtr<PasswordGenerationPopupControllerImpl> weak_this = GetWeakPtr();
if (driver_) {
// See https://crbug.com/1133635 for when `driver_` might be null due to a
// compromised renderer.
driver_->GeneratedPasswordAccepted(form_data_, generation_element_id_,
current_generated_password_);
}
// |this| can be destroyed here because GeneratedPasswordAccepted pops up
// another UI and generates some event to close the dropdown.
if (weak_this) {
driver_->FocusNextFieldAfterPasswords();
weak_this->HideImpl();
}
}
In commit https://chromium.googlesource.com/chromium/src.git/+/079002c2a37d156e88065bb58cecfad9597d7818, developer notice that driver_->GeneratedPasswordAccepted may cause PasswordGenerationPopupControllerImpl being destroyed. Thus results in UAF. However, in the PasswordGenerationPopupControllerImpl::EditPasswordClicked which is introduced later, the developer use PasswordGenerationPopupControllerImpl::Show directly after calling the GeneratedPasswordAccepted, which may involves UAF.
void PasswordGenerationPopupControllerImpl::EditPasswordClicked() {
driver_->GeneratedPasswordAccepted(form_data_, generation_element_id_,
current_generated_password_); // may free |this|
Show(kEditGeneratedPassword); // PasswordGenerationPopupControllerImpl::Show
}
Since this issue is detected by static analysis, I don't have a PoC and cannot ensure the bug existence. But you may want to manually check to be safe.
Summary
Security: Potential Use-After-Free in PasswordGenerationPopupControllerImpl::EditPasswordClicked
Custom Questions
Reporter credit:
Han Zheng (HexHive)
Additional Data
Category: Security
Chrome Channel: Stable
Regression: N/A
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 a missing re-check of the object's weak pointer after a call that can destroy the controller, so the code continues to use a possibly freed object.
Impact
If the suspected flaw is real, a compromised renderer could potentially cause a use-after-free in the browser process, but the report provides no proof and cannot confirm the bug exists.
What the attacker needed
Compromised renderer (suspected); no proof of concept provided
The fix
The code should re-check the weak pointer after the driver call before using the controller again, as the earlier fix did.
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's memory but keeps using it, that is called a use-after-free. Here a popup window's code calls a function that can close and delete the popup, then tries to show the popup again, which would touch memory that may already be gone. The reporter only spotted this by reading the code and has not shown it can actually be triggered.
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.