Use after free in Ozone (CVE-2026-10899)
A use-after-free was reported in the X11 window code of Chromium's Ozone layer, where reading window bounds can run a nested message loop that synchronously destroys the calling window object. The caller then keeps using the freed object, which the report says could lead to memory corruption and possibly code execution in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 8 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 X11Window on Linux/X11 platforms due to synchronous event dispatching during bounds calculation. When GetBoundsInPixels triggers synchronous nested message loops within GeometryCache, the calling X11Window instance can be synchronously destroyed. Subsequent operations in X11Window::SetBoundsInPixels continue executing on the freed this context, leading to potential memory corruption in the browser process.
Affected files:
ui/ozone/platform/x11/x11_window.ccui/ozone/platform/x11/x11_window.h
Estimated timestamp from git blame: 2025-03-06
Description
A potential Use-After-Free (UAF) vulnerability has been identified in X11Window on Linux/X11 platforms. The issue stems from synchronous event dispatching during bounds calculation in GeometryCache::GetBoundsPx(), which can run nested message loops via DispatchNow(). If these nested message loops result in the synchronous destruction of the calling X11Window instance, the calling function (such as X11Window::SetBoundsInPixels) will continue execution using a dangling this pointer once the stack unwinds.
Because this is a stack parameter, runtime mitigations such as MiraclePtr (base::raw_ptr<T>) do not protect against or prevent this UAF. Since this code executes within the unsandboxed browser process on Linux, this vulnerability could potentially lead to Remote Code Execution (RCE) with the privileges of the browser user.
Root Cause Analysis
When X11Window::GetBoundsInPixels() (in ui/ozone/platform/x11/x11_window.cc) is called, it delegates to geometry_cache_->GetBoundsPx():
gfx::Rect X11Window::GetBoundsInPixels() const {
return bounds_wm_sync_ || !geometry_cache_ ? last_set_bounds_px_
: geometry_cache_->GetBoundsPx();
}
Inside GeometryCache::GetBoundsPx() (in ui/gfx/x/geometry_cache.cc), if the cache is not yet ready or is waiting on parent bounds, it forces synchronous resolution by executing parent_future_.DispatchNow():
gfx::Rect GeometryCache::GetBoundsPx() {
auto weak_this = weak_ptr_factory_.GetWeakPtr();
if (!have_parent_) {
parent_future_.DispatchNow();
if (!weak_this) {
return {};
}
}
...
DispatchNow() synchronously blocks to wait for the X11 response and dispatches incoming events. This can run a nested message loop that processes incoming window events, including reparenting or configuration changes.
If a window layout change is triggered during this nested loop, it can propagate up to UI observers and synchronously trigger window closure (e.g., via views::Widget::CloseNow()). This triggers a synchronous destruction path:
Widget::CloseNow
→ DesktopWindowTreeHostPlatform::CloseNow()
→ platform_window()->Close() (X11Window::Close())
→ CloseXWindow() → geometry_cache_.reset()
→ platform_window_delegate_->OnClosed()
→ DesktopWindowTreeHostPlatform::OnClosed()
→ SetPlatformWindow(nullptr)
→ ~X11Window() [heap memory is freed]
When GeometryCache::GetBoundsPx() finishes and the stack unwinds back to X11Window::SetBoundsInPixels, the caller continues to execute on the now-freed X11Window (this) context, performing member accesses and calling virtual functions on platform_window_delegate_ which can lead to code execution.
Potential Trigger Steps (Conceptual)
An attacker could conceptually trigger this behavior by performing actions that force rapid window configuration or reparenting changes while simultaneously requesting bounds changes or fullscreen state transitions:
- Script-controlled web content requests a series of window layout operations (e.g., fullscreen toggle or window snapping/docking) that initiate a
ReparentNotifyevent on Linux/X11. - The geometry cache transitions to an un-ready state, clearing
have_parent_. - A synchronous bounds-reading API call triggers
GetBoundsInPixels(), which forces immediate synchronization viaDispatchNow(). - The resulting synchronous nested message loop processes a pending window close request, destroying the underlying
X11Windowobject. - The call stack unwinds, and the caller method
SetBoundsInPixelsoperates on the freed heap memory ofX11Window.
Note: These are potential steps reconstructed via static code analysis. Our tooling does not currently have the capability to run or validate functional exploit payloads.
Proposed Fix
To remediate this issue, X11Window should utilize its existing base::WeakPtrFactory<X11Window> to check if the object has survived any operations that can run synchronous nested message loops or notify observers.
Specifically, in X11Window::SetBoundsInPixels, we should check weak_this after calling GetBoundsInPixels():
void X11Window::SetBoundsInPixels(const gfx::Rect& bounds) {
auto weak_this = weak_ptr_factory_.GetWeakPtr();
gfx::Rect new_bounds_in_pixels(bounds.origin(),
AdjustSizeForDisplay(bounds.size()));
const gfx::Rect current_bounds = GetBoundsInPixels();
if (!weak_this) {
return;
}
const bool size_changed =
current_bounds.size() != new_bounds_in_pixels.size();
const bool origin_changed =
current_bounds.origin() != new_bounds_in_pixels.origin();
...
Any other caller of GetBoundsInPixels() in X11Window that performs member accesses or calls virtual functions immediately afterward should be similarly guarded.
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 a bounds-reading call can run a nested message loop that synchronously destroys the calling X11Window, and the caller does not re-check that the object still exists before continuing.
Impact
The report claims this could potentially lead to remote code execution with the browser user's privileges, but the steps are conceptual and were not validated with a working exploit.
What the attacker needed
Linux with X11; victim visits attacker-controlled page; window layout changes during bounds read
The fix
The report proposes guarding callers of the bounds read with the existing weak pointer so execution stops if the window was destroyed; it does not say a fix was shipped.
How it was found
- Web content requests window layout operations such as a fullscreen toggle or snapping, causing a reparent event.
- The geometry cache becomes un-ready and clears its parent flag.
- A synchronous bounds read forces immediate synchronisation and runs a nested message loop.
- The nested loop processes a pending close request, destroying the window object.
- The caller resumes and operates on the freed memory.
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 but keeps using it, that is a use-after-free. Here, asking for a window's size can quietly process other events, and one of those events can close and delete the window; the code then carries on as if the window still existed. Because this happens in the main browser process, which is not sandboxed on Linux, the report suggests it could be serious.
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.