Use after free in Ozone (CVE-2026-11629)
A use-after-free vulnerability exists in the headless Ozone window implementation because synchronous delegate callbacks can cause the window to be destroyed while its methods are still running. An attacker could potentially trigger a state change that leads to memory corruption and a virtual function call on freed memory in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 14 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 ui::HeadlessWindow due to synchronous delegate callbacks during state-changing operations. If an observer synchronously closes the widget during these callbacks, the underlying HeadlessWindow is deleted while its methods are still executing on the stack. Subsequent execution leads to UAF member accesses and a virtual function call in the browser process.
Affected files:
ui/ozone/platform/headless/headless_window.ccui/ozone/platform/headless/headless_window.h
Estimated timestamp from git blame: 2023-09-29
Root Cause
In ui/ozone/platform/headless/headless_window.cc, multiple state-changing operations such as SetFullscreen(), Maximize(), Minimize(), and Restore() invoke delegate callbacks synchronously (e.g., delegate_->OnBoundsChanged() via UpdateBounds()). These callbacks propagate up to observers (such as WidgetObserver or WindowTreeHostObserver), which can synchronously close and destroy the widget and window via Widget::CloseNow() under certain application states.
Because HeadlessWindow lacks any base::WeakPtrFactory or liveness checks, it is vulnerable to being deleted while its methods are still active on the call stack.
Potential Call Stack and Destruction Sequence
When a widget is closed during a bounds-changed or state-changed notification, the destruction sequence proceeds as follows:
ui::HeadlessWindow::SetFullscreen()callsZoomWindowBounds(), which callsUpdateBounds(), which synchronously invokesdelegate_->OnBoundsChanged().- This propagates through
WindowTreeHostPlatform::OnBoundsChanged()andDesktopNativeWidgetAura::OnHostResized(), callingWidget::OnNativeWidgetSizeChanged(). - A registered observer synchronously calls
Widget::CloseNow(). - This delegates to
DesktopWindowTreeHostPlatform::CloseNow(), which callsplatform_window()->Close(). HeadlessWindow::Close()synchronously callsdelegate_->OnClosed(), resulting in a call toSetPlatformWindow(nullptr)insideDesktopWindowTreeHostPlatform::OnClosed().SetPlatformWindow(nullptr)resets the unique pointer owning theHeadlessWindow, synchronously destroying it.- The call stack unwinds back to
HeadlessWindow::SetFullscreen(), which proceeds to executeUpdateWindowState(PlatformWindowState::kFullScreen)on the now-freedthispointer. - Inside
UpdateWindowState(), the code attempts a write towindow_state_and a virtual call ondelegate_(which is also a dangling pointer or reclaimed memory).
Suggested / Potential Steps to Reproduce
Note: These are potential steps based on source code analysis; our tooling does not currently support running code to verify this dynamically.
- Run Headless Chrome (
--headless) on Linux with Ozone. - Trigger a state change (such as fullscreen via
element.requestFullscreen()) from a renderer process or headless test script. - Register an observer (e.g., a custom
WidgetObserveror layout observer) that responds to the resulting bounds change by synchronously callingWidget::CloseNow(). - Observe the Use-After-Free condition when control returns to the call stack of
HeadlessWindow::SetFullscreen()and attempts to accesswindow_state_or invokedelegate_->OnWindowStateChanged().
Proposed Fix
Add a base::WeakPtrFactory<HeadlessWindow> member to HeadlessWindow. Guard any call sites that invoke delegate methods synchronously by taking a weak pointer first, and verifying its liveness before accessing any member variables or calling subsequent helper functions.
For example, in ui/ozone/platform/headless/headless_window.cc:
void HeadlessWindow::SetFullscreen(bool fullscreen, int64_t target_display_id) {
DCHECK_EQ(target_display_id, display::kInvalidDisplayId);
if (!delegate_->CanFullscreen()) {
return;
}
auto weak_this = weak_ptr_factory_.GetWeakPtr();
if (fullscreen) {
if (window_state_ != PlatformWindowState::kMaximized &&
window_state_ != PlatformWindowState::kFullScreen) {
restored_bounds_ = bounds_;
}
ZoomWindowBounds();
if (!weak_this) {
return;
}
UpdateWindowState(PlatformWindowState::kFullScreen);
} else {
if (window_state_ != PlatformWindowState::kFullScreen) {
return;
}
RestoreWindowBounds();
if (!weak_this) {
return;
}
UpdateWindowState(PlatformWindowState::kNormal);
}
}
Evaluated with Chrome root at commit: a2bea94528f4bd6cc57739c43fa3bb890b8367d3
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 lack of a weak pointer or liveness check in HeadlessWindow allows synchronous delegate callbacks to destroy the object while its methods are still on the call stack.
Impact
This could lead to memory corruption and a virtual function call on freed memory in the browser process, potentially allowing code execution, though the report notes the steps are unverified.
What the attacker needed
Headless Chrome on Linux with Ozone; Ability to trigger a state change; An observer that closes the widget synchronously
The fix
The suggested fix is to add a base::WeakPtrFactory to HeadlessWindow and check liveness after synchronous delegate calls before accessing members.
How it was found
- Run Headless Chrome on Linux with Ozone.
- Trigger a state change such as fullscreen from a renderer or test script.
- Register an observer that synchronously calls Widget::CloseNow() on the bounds change.
- Observe the use-after-free when control returns to SetFullscreen().
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 memory but then keeps using it, like deleting a file and then trying to open it. Here, a window can be closed and destroyed in the middle of a function that is still running, so the function later touches memory that no longer belongs to it. This can crash the browser or, in theory, 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.