Skip to content
Memory corruption Advisory Advanced CVE-2026-11628

Use after free in Ozone (CVE-2026-11628)

A use-after-free was reported in Chromium's Wayland event handling: a raw window pointer held on the stack is reused across loop iterations after a synchronous event dispatch can destroy the window. An attacker could potentially trigger memory corruption in the unsandboxed browser process, though the report is theoretical and no proof of concept was run.

Google Chrome

Originally disclosed on Chrome VRP

Critical View original
  • Fix shipped in 15 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 WaylandEventSource::ReleasePressedPointerButtons due to the reuse of a bare WaylandWindow pointer across event dispatch iterations. If a synchronous event dispatch destroys the window, subsequent iterations of the loop access the freed memory. This bypasses MiraclePtr protections because the dangling pointer is held directly on the call stack.

Affected files:

  • ui/ozone/platform/wayland/host/wayland_event_source.cc

Estimated timestamp from git blame: 2024-05-27

Root Cause

In ui/ozone/platform/wayland/host/wayland_event_source.cc, the method ReleasePressedPointerButtons takes a bare WaylandWindow* parameter and loops over pressed pointer buttons, calling OnPointerButtonEvent with the kImmediate dispatch policy:

C++
void WaylandEventSource::ReleasePressedPointerButtons(
    WaylandWindow* window,
    base::TimeTicks timestamp) {
  if (!pointer_flags_) return;
  for (const auto& [button, name] : kMouseButtonToStringMap) {
    if (button & pointer_flags_) {
      OnPointerButtonEvent(EventType::kMouseReleased, button, timestamp, window,
                           wl::EventDispatchPolicy::kImmediate, false, true);
      pointer_flags_ &= ~button;
    }
    if (!pointer_flags_) break;
  }
}

When dispatch_policy is wl::EventDispatchPolicy::kImmediate, OnPointerButtonEvent synchronously dispatches the event via SetTargetAndDispatchEvent. This synchronous dispatch can run UI event handlers or spin a nested message loop (for example, if a modal dialog, menu, or drag controller runs during the event handler).

If a UI task runs during this synchronous execution and destroys the WaylandWindow, the bare window pointer on ReleasePressedPointerButtons's local stack becomes a dangling pointer. Since it is a local parameter on the stack, it is not tracked or cleared when the window is destroyed. On the next iteration of the loop, this dangling pointer is passed to OnPointerButtonEvent again.

Furthermore, inside OnPointerButtonEvent, a completion closure is created that captures the previous focused window as a raw pointer prev_focused_window. If that previous window is destroyed during the synchronous event pipeline execution, running this closure similarly results in a Use-After-Free.

Why MiraclePtr / BackupRefPtr Does Not Protect This

MiraclePtr (BackupRefPtr) is bypassed because the dangling pointer is a bare pointer on the stack, not a raw_ptr<> member. When the window is destroyed, WaylandWindowManager::RemoveWindow erases the window and nulls out the fields containing raw_ptr<WaylandWindow> (such as pointer_focused_window_). As there are no remaining active raw_ptr references holding the allocation, the refcount drops to 0, and the memory slot is immediately freed and returned to the PartitionAlloc freelist, where it can be reclaimed and overwritten.

Potential Trigger Steps

Note: The following steps are theoretical/potential as our tooling does not currently have the ability to run code or verify via a working proof of concept.

  1. The user has multiple pointer (mouse) buttons registered as pressed (e.g., Left and Right).
  2. An event triggers ReleasePressedPointerButtons, passing the target WaylandWindow as a raw stack parameter.
  3. The loop processes the first button release, synchronously dispatching the event.
  4. During the synchronous dispatch of the first button release, a Views UI event handler or nested message loop is executed, which destroys the target window (and/or the previously focused window).
  5. The window map erases the window, and its memory is immediately deallocated and returned to the PartitionAlloc freelist.
  6. The loop continues to the next iteration to release the second button.
  7. The dangling window pointer on the stack is passed to OnPointerButtonEvent, which dereferences it via window_manager_->SetPointerFocusedWindow(window) -> window->OnPointerFocusChanged(true), leading to a potential Use-After-Free in the unsandboxed browser process.

Suggested Fix

To resolve this issue, capture a base::WeakPtr<WaylandWindow> at the beginning of ReleasePressedPointerButtons and verify its validity before each iteration or event dispatch. Additionally, the bound prev_focused_window in the completion closure inside OnPointerButtonEvent should be tracked using a base::WeakPtr rather than a raw pointer.

C++
void WaylandEventSource::ReleasePressedPointerButtons(
    WaylandWindow* window,
    base::TimeTicks timestamp) {
  if (!pointer_flags_) return;
  base::WeakPtr<WaylandWindow> window_weak = window ? window->AsWeakPtr() : nullptr;
  for (const auto& [button, name] : kMouseButtonToStringMap) {
    if (!window_weak) {
      break;
    }
    if (button & pointer_flags_) {
      OnPointerButtonEvent(EventType::kMouseReleased, button, timestamp, window_weak.get(),
                           wl::EventDispatchPolicy::kImmediate, false, true);
      pointer_flags_ &= ~button;
    }
    if (!pointer_flags_) break;
  }
}

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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 holds a bare WaylandWindow pointer on the stack and reuses it after a synchronous event dispatch can destroy the window, and a completion closure similarly captures a raw previous-focused-window pointer.

Impact

Could lead to a use-after-free in the unsandboxed browser process, but the report is theoretical and no working proof of concept was produced.

What the attacker needed

Wayland desktop session; multiple mouse buttons pressed; window destroyed during event dispatch

The fix

Should be fixed by capturing a base::WeakPtr<WaylandWindow> at the start of ReleasePressedPointerButtons and checking it before each dispatch, and by tracking the previous focused window in the completion closure with a base::WeakPtr.

How it was found

  1. Have multiple mouse buttons registered as pressed.
  2. An event calls ReleasePressedPointerButtons with the target window as a raw stack parameter.
  3. The loop processes the first button release and dispatches it synchronously.
  4. During that dispatch, a UI handler or nested message loop destroys the target window.
  5. The window is erased and its memory returned to the allocator freelist.
  6. The loop continues and passes the dangling pointer to OnPointerButtonEvent, which dereferences it.

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 keeps a note of where some data lives, the data is deleted, and the program then reads or writes through the old note. Here the note is a plain pointer kept on the call stack, so Chromium's usual protection for such pointers does not apply. The report is a code review finding, not a demonstrated attack.

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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.