Use after free in Ozone (CVE-2026-15765)
A use-after-free was identified in the WaylandBubble widget code on Linux Wayland, where base class state-update calls can synchronously destroy the widget and the override methods then keep using the freed object. An attacker controlling web content could potentially trigger a state update that tears down a bubble window, leading to memory corruption in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 47 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 WaylandBubble on Linux Wayland due to synchronous widget destruction during bounds or scale updates. When the calling window state-request pipeline synchronously destroys the widget, the call stack unwinds back to WaylandBubble override methods, which continue to access members of the freed object. This issue resides in the browser process, affecting systems running Chrome on Linux under Wayland.
Affected files:
ui/ozone/platform/wayland/host/wayland_bubble.ccui/ozone/platform/wayland/host/wayland_bubble.h
Estimated timestamp from git blame: 2024-03-30
Root Cause Analysis
Inside ui/ozone/platform/wayland/host/wayland_bubble.cc, multiple overrides of WaylandBubble call into the base WaylandWindow state-request machinery. These base class methods can synchronously apply the requested state and notify delegates, which can lead to the synchronous destruction of the widget (and the calling WaylandBubble instance itself). When control returns from the base class to the subclass overrides, execution continues on the freed this pointer with no liveness check, despite the class implementing a WeakPtrFactory.
For example, in WaylandBubble::SetBoundsInDIP:
void WaylandBubble::SetBoundsInDIP(const gfx::Rect& bounds_dip) {
auto old_bounds_dip = GetBoundsInDIP();
WaylandWindow::SetBoundsInDIP(bounds_dip); // May synchronously free |this|
if (subsurface_ && old_bounds_dip != bounds_dip) { // Potential UAF read of this->subsurface_
SetSubsurfacePosition(); // Potential UAF dereference
}
}
Similarly, WaylandBubble::UpdateWindowScale is vulnerable:
void WaylandBubble::UpdateWindowScale(bool update_bounds) {
WaylandWindow::UpdateWindowScale(update_bounds); // May synchronously free |this|
if (subsurface_) { // Potential UAF read of this->subsurface_
SetSubsurfacePosition(); // Potential UAF dereference
}
}
Potential Trigger Path
An attacker controlling web content could potentially trigger this by inducing a state update that leads to synchronous window destruction through the following sequence:
- Web content interacts with a UI component that creates a bubble window (such as an Autofill popup or custom menu widget) implemented as a
WaylandBubble. - The UI layout engine modifies the bounds or preferred scale of the widget, invoking
WaylandBubble::SetBoundsInDIPorWaylandBubble::UpdateWindowScale. - The override delegates to the base class implementation, e.g.,
WaylandWindow::SetBoundsInDIP->RequestStateFromClient->MaybeApplyLatestStateRequest. - Inside
MaybeApplyLatestStateRequest, the code synchronously callsdelegate()->OnStateUpdate(). - The delegate notifies window tree and widget observers of the bounds or scale change. If an observer synchronously tears down or closes the widget (for instance, if the layout change places the bubble out-of-bounds or invalidates its parent window), the
WaylandBubbleobject is synchronously deleted. - While the base class
WaylandWindow::MaybeApplyLatestStateRequestcorrectly guards against this destruction via aWeakPtrcheck (AsWeakPtr()), theWaylandBubbleoverrides do not perform any check when the stack unwinds back to them, resulting in a Use-After-Free when accessingsubsurface_or callingSetSubsurfacePosition().
Note: Our tooling does not currently have the capability to run a live proof-of-concept exploit, so these steps represent a potential execution flow based on static analysis of the source code.
Suggested Fix
To prevent this vulnerability, introduce weak pointer checks immediately after calls to base class methods that handle state changes, ensuring that execution returns early if the window has been destroyed:
void WaylandBubble::SetBoundsInDIP(const gfx::Rect& bounds_dip) {
auto old_bounds_dip = GetBoundsInDIP();
auto weak_this = AsWeakPtr();
WaylandWindow::SetBoundsInDIP(bounds_dip);
if (!weak_this) {
return;
}
if (subsurface_ && old_bounds_dip != bounds_dip) {
SetSubsurfacePosition();
}
}
void WaylandBubble::UpdateWindowScale(bool update_bounds) {
auto weak_this = AsWeakPtr();
WaylandWindow::UpdateWindowScale(update_bounds);
if (!weak_this) {
return;
}
if (subsurface_) {
SetSubsurfacePosition();
}
}
Evaluated with Chrome root at commit: fb72408a8493c46bc75fae1c70d03daec96b3040
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 WaylandBubble override methods call base class state-request functions that can synchronously destroy the widget, and they do not check a weak pointer for liveness before continuing to use members such as subsurface_.
Impact
An attacker controlling web content could potentially cause a use-after-free in the browser process, which may lead to memory corruption; the text notes no live proof-of-concept was run, so this is based on static analysis only.
What the attacker needed
Chrome on Linux running under Wayland; Victim visits attacker-controlled web content; A bubble UI component is shown
The fix
The suggested fix is to capture a weak pointer before calling the base class method and return early if the object has been destroyed.
How it was found
- Web content interacts with a UI component that creates a bubble window implemented as a WaylandBubble.
- The UI layout engine changes the bounds or preferred scale, invoking SetBoundsInDIP or UpdateWindowScale.
- The override delegates to the base class implementation, which requests and applies the latest state.
- The delegate notifies observers, and an observer synchronously tears down the widget, deleting the WaylandBubble.
- The stack unwinds back to the override, which accesses subsurface_ or calls SetSubsurfacePosition on the freed object.
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 deletes an object from memory but keeps using it afterwards, like reading a note after shredding it. Here, a small popup window in the browser can be closed while code is still in the middle of resizing it, and the remaining code then touches the deleted window. Because this runs inside the browser itself, a malicious web page might be able to corrupt memory and potentially run 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.