Use after free in Ozone (CVE-2026-17656)
A raw pointer to the focused Wayland window is cached outside the event dispatch loop, so if the first queued pointer event synchronously destroys that window, later events in the same frame use a dangling pointer. The report claims this yields a reliable double-free in the browser process that could be developed into a sandbox escape.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 46 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 raw pointer to a WaylandWindow is cached across multiple event dispatches in WaylandEventSource::OnPointerFrameEvent. If a window is synchronously closed during dispatch, subsequent events in the same frame will use the dangling pointer, leading to a highly reliable double-free via BackupRefPtr in the browser process.
Affected files:
ui/ozone/platform/wayland/host/wayland_event_source.cc
Estimated timestamp from git blame: Unknown (Google3 checkout)
Description
A Use-After-Free (UAF) vulnerability exists in WaylandEventSource::OnPointerFrameEvent within Chromium's Wayland implementation (ui/ozone/platform/wayland/host/wayland_event_source.cc).
The function is responsible for draining the pointer_frames_ queue, which can contain multiple events (e.g., mouse movement and button release) received in a single Wayland protocol frame. It incorrectly caches a raw pointer to the currently focused window (target) outside of the dispatch loop and reuses it without verifying the window's liveness.
void WaylandEventSource::OnPointerFrameEvent() {
// ...
auto* target = window_manager_->GetCurrentPointerFocusedWindow();
if (!target) {
return;
}
while (!pointer_frames_.empty()) {
auto pointer_frame = std::move(pointer_frames_.front());
pointer_frames_.pop_front();
SetTargetAndDispatchEvent(pointer_frame->event.get(), target);
if (!pointer_frame->completion_cb.is_null()) {
std::move(pointer_frame->completion_cb).Run();
}
}
}
During the execution of SetTargetAndDispatchEvent, an event is dispatched to the UI system. This dispatch can trigger synchronous window destruction (e.g., closing a dropdown popup or menu widget that uses WIDGET_OWNS_NATIVE_WIDGET). If the window is destroyed during the first iteration of the loop, the target pointer becomes dangling. In subsequent iterations, SetTargetAndDispatchEvent is called with this dangling pointer.
Exploitation and Impact
This UAF occurs in the Browser process and can be leveraged into a highly reliable double-free primitive, leading to a potential Sandbox Escape.
Suggested potential steps for an attacker to trigger the vulnerability:
- The attacker controls a malicious web page that convinces a user to interact with a native UI element backed by a
WaylandWindow(e.g., a native<select>dropdown menu or context menu). - The user interaction triggers multiple Wayland pointer events within a single display frame (e.g., moving the mouse while releasing a click generates
wl_pointer.button,wl_pointer.motion, andwl_pointer.frame). - Because the standard dispatch policy is
wl::EventDispatchPolicy::kOnFrame, the button and motion events are queued inpointer_frames_. - When
wl_pointer.framearrives,OnPointerFrameEvent()begins to drain the queue. - The first event (button release) is dispatched to the
targetwindow. This click causes the popup widget to close synchronously, destroying theWaylandWindow. - The
WaylandWindowmemory is freed by PartitionAlloc. During this free, BackupRefPtr (BRP) clears thekMemoryHeldByAllocatorBitin the slot's metadata. - The
whileloop continues to the next event (the motion event).SetTargetAndDispatchEventis called with the danglingtargetpointer. - Inside
SetTargetAndDispatchEvent, the dangling pointer is assigned to the event'sraw_ptr<EventTarget> target_field. This triggers BRP'sAcquireInternal(), which increments the reference count on the already-freed slot's metadata. - When the event is destroyed at the end of the loop iteration, the
raw_ptrdestructor callsReleaseInternal(). ReleaseInternal()decrements the reference count back to 0. It then checks if the memory is held by the allocator (count & kMemoryHeldByAllocatorBit). Because this bit was cleared during the initial free (Step 6), BRP mistakenly believes it should free the object from quarantine.PartitionRoot::FreeAfterBRPQuarantineis called, which places the already-freed slot into the PartitionAlloc thread cache again.- This creates a cyclic/corrupted freelist (Double-Free), allowing the attacker to spray the heap, overlap objects, and hijack execution flow in the browser process.
(Note: These are suggested steps based on static analysis; our tooling agent does not yet execute code to provide a working PoC).
Suggested Fix
Similar functions in the same file correctly handle this scenario by using base::WeakPtr (e.g., OnPointerButtonEvent and ReleasePressedPointerButtons). OnPointerFrameEvent should be updated to use a WeakPtr for the target window and check for its validity before each dispatch:
auto* target_window = window_manager_->GetCurrentPointerFocusedWindow();
if (!target_window) {
return;
}
base::WeakPtr<WaylandWindow> target = target_window->AsWeakPtr();
while (!pointer_frames_.empty()) {
auto pointer_frame = std::move(pointer_frames_.front());
pointer_frames_.pop_front();
if (target) {
SetTargetAndDispatchEvent(pointer_frame->event.get(), target.get());
}
// ...
Evaluated with Chrome root at commit: 65b3256311f3ab6fb9870eaa522de7e6dd2663bb
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 function caches the focused window as a raw pointer before the dispatch loop and never re-checks whether the window still exists after each event is dispatched.
Impact
The report claims a highly reliable double-free in the browser process that could lead to a sandbox escape, though the steps are from static analysis and no working proof of concept was produced.
What the attacker needed
User interacts with a native UI element; Wayland display server session; several pointer events in one frame
The fix
The function should hold the target window as a weak pointer and check it is still valid before each dispatch, as neighbouring functions in the same file already do.
How it was found
- The attacker's page gets the user to interact with a native UI element such as a dropdown or context menu.
- The interaction produces several pointer events in one display frame, which are queued.
- When the frame event arrives, the queue is drained and the first event closes the popup, destroying the window.
- The loop continues and dispatches the next event using the freed window pointer.
- The allocator's reference counting is confused and the same memory is freed again, corrupting the freelist.
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 a pointer to it and later uses that pointer, it is called a use-after-free. Here the browser remembers which window the mouse is over, then handles several mouse events in a row; if the first event closes that window, the remaining events still refer to the freed window. The report argues this confuses the memory allocator into freeing the same block twice, which an attacker could abuse.
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.