Use after free in UI (CVE-2026-7991)
A use-after-free exists in the browser's window manager: when a transient child window is shown while its parent is hidden, the code re-hides it using a helper that holds a raw pointer to a flag on the manager. If an observer destroys the window during that hide call, the manager is freed and the helper later writes a zero byte into the freed memory.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 34 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 without the security team.
Overview: A potential 1-byte Use-After-Free (UAF) write of 0x00 exists in TransientWindowManager within the browser process. It occurs if a window is synchronously destroyed during a nested window_->Hide() call. base::AutoReset attempts to restore a boolean flag on the freed manager, bypassing MiraclePtr protections.
Affected files:
ui/wm/core/transient_window_manager.cc
Estimated timestamp from git blame: 2014-10-07
Description
A potential Use-After-Free (UAF) vulnerability exists in the browser process's windowing system (Aura/Ash) within wm::TransientWindowManager::OnWindowVisibilityChanged. The issue is triggered if an aura::Window is synchronously destroyed during a visibility change, leading to a 1-byte write of 0x00 to freed memory.
When a transient child window is shown while its parent is hidden, the manager temporarily sets a flag and re-hides the child window. This is implemented using base::AutoReset in ui/wm/core/transient_window_manager.cc:
if (!transient_parent_->TargetVisibility() && visible) {
base::AutoReset<bool> reset(&ignore_visibility_changed_event_, true);
show_on_parent_visible_ = true;
window_->Hide();
}
The base::AutoReset object stores a raw pointer to the ignore_visibility_changed_event_ member. Crucially, base::AutoReset annotates its internal pointer with RAW_PTR_EXCLUSION for performance reasons. This means the pointer bypasses PartitionAlloc's MiraclePtr (BackupRefPtr) protections.
When window_->Hide() is called, it triggers OnWindowVisibilityChanged on all observers of the window. The Aura framework explicitly supports observers synchronously destroying the window during this callback (handled safely internally via aura::WindowTracker). If the window is destroyed, aura::Window::~Window() clears the window's property map (ClearProperties()). Because TransientWindowManager is an owned property (DEFINE_OWNED_UI_CLASS_PROPERTY_KEY), it is synchronously deleted, and its heap memory is freed.
When window_->Hide() returns, the AutoReset object goes out of scope. Its destructor blindly writes the original value (false, which is 0x00) back to the now-freed TransientWindowManager memory allocation.
Potential Attacker Steps
Note: These are suggested/potential steps based on code analysis. Our tooling agent does not yet have the ability to run code to verify a full exploit chain.
An attacker with initial execution in a compromised guest or client (such as an ARC++ app or a Wayland client via Exo) could potentially trigger this by:
- Creating two windows via the windowing system:
Window P(Parent) andWindow C(Child). - Hiding
Window P. - Requesting that
Window Cbe made a transient child ofWindow Pwithparent_controls_visibilityenabled. - Registering a UI state or Exo client callback that synchronously destroys
Window Cwhen it receives a "window hidden" event. - Issuing a request to
Show()Window C.
The Show() request will enter OnWindowVisibilityChanged, trigger the AutoReset, and immediately call Hide(). The attacker's callback then destroys the window, freeing the manager. The AutoReset destructor then writes 0x00 into the freed chunk. By using heap grooming techniques, the attacker could reallocate an object of the same size into that chunk before the UAF write occurs, corrupting a critical field and potentially leading to a sandbox escape.
Suggested Fix
Remove the use of base::AutoReset in this function, as the this pointer's lifetime is not guaranteed across the window_->Hide() call.
Instead, use a base::WeakPtr to safely check if the TransientWindowManager has survived the Hide() call before restoring the variable:
if (!transient_parent_->TargetVisibility() && visible) {
ignore_visibility_changed_event_ = true;
show_on_parent_visible_ = true;
auto weak_this = weak_factory_.GetWeakPtr();
window_->Hide();
if (weak_this) {
ignore_visibility_changed_event_ = false;
}
}
(Note: TransientWindowManager will need a base::WeakPtrFactory added to its class definition). Alternatively, use base::WeakAutoReset if a weak pointer factory is added.
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 restores a member flag through a raw pointer held by base::AutoReset across a call that can synchronously destroy the owning object, and that pointer is excluded from MiraclePtr protection.
Impact
An attacker with initial code execution in a guest or client could potentially corrupt a freed heap chunk and, with heap grooming, may escalate towards a sandbox escape; the report notes the chain is unverified.
What the attacker needed
Initial code execution in a guest or client; ability to create and control windows; callback that destroys window on hide
The fix
The report suggests replacing base::AutoReset with a weak-pointer check (or base::WeakAutoReset) so the flag is only restored if the manager still exists after the hide call.
How it was found
- Create a parent window and a child window through the windowing system.
- Hide the parent window.
- Make the child a transient child of the parent with parent-controlled visibility.
- Register a callback that synchronously destroys the child when it receives a hidden event.
- Request that the child window be shown.
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 window manager keeps small helper objects that track things like whether a window is visible. Here, one helper keeps a direct reference to a flag inside such an object, and when the window is closed at just the wrong moment that object is thrown away. The helper then still writes to the old, freed spot, which is called a use-after-free and can let an attacker corrupt memory.
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.