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

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

A use-after-free was identified in WaylandWindow::OnDragSessionClose on Linux Wayland, where a synchronous drag-finished callback can destroy the window and the function then dereferences the freed object. An attacker could potentially trigger this by starting a drag and causing the source window to close during the drag, though the analysis is static only and no proof-of-concept was run.

Google Chrome

Originally disclosed on Chrome VRP

Critical View original
  • Fix shipped in 49 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 WaylandWindow::OnDragSessionClose on Linux Wayland. The function invokes a synchronous callback that can result in the immediate destruction of the WaylandWindow. Upon returning from the callback, the function dereferences the already deallocated window's member variables, resulting in a use-after-free.

Affected files:

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

Estimated timestamp from git blame: 2024-06-05

Root Cause

In WaylandWindow::OnDragSessionClose (located in ui/ozone/platform/wayland/host/wayland_window.cc), the implementation invokes a synchronous callback and subsequently accesses member variables via the this pointer without verifying the window's liveness:

C++
void WaylandWindow::OnDragSessionClose(DragOperation operation) {
  if (!drag_finished_callback_) {
    return;
  }
  std::move(drag_finished_callback_).Run(operation);                       // [1]
  if (!connection()->data_drag_controller()->IsWindowDragSessionRunning()) { // [2]
    connection()->event_source()->ReleasePressedPointerButtons(
        this, EventTimeForNow());
  }
  std::move(drag_loop_quit_closure_).Run();                                // [3]
}
  1. At [1], drag_finished_callback_ is executed synchronously. This invokes DesktopDragDropClientOzone::OnDragFinished, notifying drag-and-drop observers (such as TabDragController).
  2. If an observer synchronously destroys the parent widget (for example, if the last tab is dragged out and the window closes via a synchronous CloseNow()), the underlying WaylandWindow is deleted immediately. This occurs because DesktopWindowTreeHostPlatform::OnClosed() calls SetPlatformWindow(nullptr), which deletes the std::unique_ptr<ui::PlatformWindow> holding the WaylandWindow instance.
  3. Upon returning from the callback to [2] and [3], the function dereferences this->connection_ and this->drag_loop_quit_closure_ on the already-deleted WaylandWindow instance, leading to a Use-After-Free.

Potential Trigger Path

Based on static analysis, an attacker could potentially trigger this vulnerability through the following steps:

  1. Initiate Drag: The user (or a renderer-initiated script) begins an outgoing drag-and-drop session.
  2. Store Callbacks: WaylandWindow::StartDrag spins a nestable run loop and registers drag_finished_callback_ and drag_loop_quit_closure_.
  3. Close Event: During the active drag session, a close task for the source window is queued or triggered.
  4. Drag Completion: The drag completes, which executes WaylandWindow::OnDragSessionClose.
  5. Synchronous Window Destruction: The synchronous execution of drag_finished_callback_.Run() triggers observer cleanup, which processes the window close synchronously (e.g., via CloseNow()), immediately destroying WaylandWindow.
  6. Use-After-Free: Execution resumes in OnDragSessionClose on the deleted this pointer, resulting in a UAF when dereferencing connection() or drag_loop_quit_closure_.

Note: Our analysis is currently based on static code review, as our tooling does not yet have the ability to run code or compile a functional proof-of-concept.

Proposed Fix

To remediate this issue, the lifetime of the WaylandWindow must be monitored using a WeakPtr. Additionally, the loop quit closure should be moved to a local variable prior to executing any client callbacks to ensure the nested run loop can be cleanly terminated even if the window is destroyed.

C++
void WaylandWindow::OnDragSessionClose(DragOperation operation) {
  if (!drag_finished_callback_) {
    return;
  }

  // Move the callback and loop closure to local variables.
  auto drag_finished_callback = std::move(drag_finished_callback_);
  auto drag_loop_quit_closure = std::move(drag_loop_quit_closure_);

  // Track the liveness of 'this' using a WeakPtr.
  base::WeakPtr<WaylandWindow> weak_this = AsWeakPtr();

  std::move(drag_finished_callback).Run(operation);

  // If the window was destroyed during the callback, quit the nested loop safely and exit.
  if (!weak_this) {
    if (drag_loop_quit_closure) {
      std::move(drag_loop_quit_closure).Run();
    }
    return;
  }

  if (!connection()->data_drag_controller()->IsWindowDragSessionRunning()) {
    connection()->event_source()->ReleasePressedPointerButtons(
        this, EventTimeForNow());
  }

  if (drag_loop_quit_closure) {
    std::move(drag_loop_quit_closure).Run();
  }
}

Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8


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

The function runs a synchronous callback that can delete the object, then continues to access its own members without checking whether it still exists.

Impact

An attacker could potentially cause a use-after-free in the browser process, which may lead to a crash or possibly code execution, but this is based on static analysis only and no exploit was demonstrated.

What the attacker needed

Linux with Wayland; user or script starts a drag; source window closes during drag

The fix

The lifetime of the window should be tracked with a WeakPtr and the loop-quit closure moved to a local variable before running any callbacks.

How it was found

  1. Start an outgoing drag-and-drop session from a window.
  2. The drag registers a finished callback and a loop-quit closure.
  3. A close task for the source window is queued or triggered during the drag.
  4. The drag completes and the close callback runs synchronously.
  5. The callback destroys the window, and the function then uses 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.

When a drag-and-drop finishes, the browser runs some cleanup code. That cleanup can close the window the drag started from, which frees the window's memory. The original function then keeps using that freed memory, which is called a use-after-free and 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.

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.