Use after free in Views (CVE-2026-11661)
The headless Windows window handler performs synchronous delegate callouts without re-entrancy guards, so an observer that destroys the window during a movement callout leaves the method accessing freed memory. A compromised renderer could trigger this use-after-free in the unsandboxed browser process, potentially leading to arbitrary code execution.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 24 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: The HWNDMessageHandlerHeadless class, used for Chrome's native headless mode on Windows, performs synchronous callouts without re-entrancy guards. If an observer synchronously destroys the window during a movement callout, subsequent code in the same method attempts to access the freed object. This can result in a browser-process crash or potential arbitrary code execution.
Affected files:
ui/views/win/hwnd_message_handler_headless.ccui/views/win/hwnd_message_handler.hui/views/win/hwnd_message_handler.cc
Estimated timestamp from git blame: 2023-10-09
Summary
In Chrome's native headless mode on Windows (--headless=new), the HWNDMessageHandlerHeadless class manages window operations. Several methods in this class issue synchronous callouts to a delegate (HWNDMessageHandlerDelegate). Because these callouts can trigger observers that synchronously destroy the Widget and its associated message handler, the omission of re-entrancy guards leads to a potential Use-After-Free (UAF) vulnerability.
In the base class HWNDMessageHandler, these operations are explicitly protected by a base::WeakPtr guard (using msg_handler_weak_factory_). However, HWNDMessageHandlerHeadless overrides these methods but fails to implement similar protections.
Technical Details
In ui/views/win/hwnd_message_handler_headless.cc, the method SetBoundsInternal (lines 443-461) performs a synchronous callout to the delegate:
void HWNDMessageHandlerHeadless::SetBoundsInternal(
const gfx::Rect& bounds_in_pixels, bool force_size_changed) {
gfx::Rect old_bounds = GetClientAreaBounds();
SetHeadlessWindowBounds(bounds_in_pixels);
if (old_bounds.origin() != bounds_in_pixels.origin()) {
delegate_->HandleMove(); // [1] Synchronous Callout
}
// [2] Potential UAF access on 'this' and 'delegate_'
if (old_bounds.size() != bounds_in_pixels.size() || force_size_changed) {
delegate_->HandleClientSizeChanged(GetClientAreaBounds().size());
}
}
If the call at [1] triggers an observer (such as a WindowTreeHostObserver) that synchronously closes the window (e.g., via Widget::CloseNow()), the HWNDMessageHandlerHeadless instance is destroyed. When execution returns to [2], the code attempts to access members of the freed object, including a virtual method call to GetClientAreaBounds().
Similar issues exist in other methods that perform callouts, including:
Maximize()Minimize()Restore()Show()SetSize()Activate()/Deactivate()
Potential Attack Vector
Note: These steps are based on static analysis and have not been verified with a functional Proof of Concept.
- A compromised renderer process initiates a window movement or resize request (e.g., calling
window.moveTo()on a popup window). - The request reaches the browser process and is routed to
HWNDMessageHandlerHeadless::SetBoundsInternal. - A UI observer (e.g., reacting to
OnHostMovedInPixels) synchronously destroys the widget during the movement callout. - The browser process attempts to continue execution in the freed
SetBoundsInternalstack frame, leading to a UAF.
Impact
This is a potential browser-process UAF. Since the browser process is unsandboxed, a successful exploit could allow for arbitrary code execution with the user's full privileges.
Suggested Fix
HWNDMessageHandlerHeadless should implement re-entrancy guards similar to the base class. Before making any delegate callout that could result in destruction, the code should acquire a base::WeakPtr and verify the object's validity before proceeding with subsequent member accesses.
auto weak_ptr = msg_handler_weak_factory_.GetWeakPtr();
delegate_->HandleMove();
if (!weak_ptr) return;
Evaluated with Chrome root at commit: 1a8d40fc44df2088d5945c0bf53584038aa1614a
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
The headless window handler overrides base-class methods but omits the base class's weak-pointer re-entrancy guard, so a synchronous delegate callout can destroy the object and leave the method using freed memory.
Impact
This is a potential browser-process use-after-free; because the browser process is unsandboxed, a successful exploit could allow arbitrary code execution with the user's full privileges.
What the attacker needed
Chrome native headless mode on Windows; Compromised renderer process; A UI observer that destroys the window
The fix
The headless handler should add re-entrancy guards like the base class, taking a weak pointer before any delegate callout and checking it before further member access.
How it was found
- A compromised renderer asks to move or resize a popup window.
- The request reaches the headless window handler's bounds-setting method.
- A UI observer synchronously destroys the widget during the movement callout.
- The browser process continues in the freed method and triggers 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.
A use-after-free happens when a program frees an object but then keeps using it, like deleting a file and still trying to read it. Here, a window handler calls out to other code that can close and destroy the window, and when control returns the handler still touches the now-freed object. Because this runs in the browser's main process, which has no sandbox, an attacker who can trigger it might 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.