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

Use after free in UI (CVE-2026-16423)

A use-after-free was identified in the X11 drag-and-drop move loop cleanup, where a delegate callback can synchronously destroy the source window and recursively free the move loop object. The outer call then dereferences the freed object, potentially allowing control-flow hijack 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 X11WholeScreenMoveLoop::EndMoveLoop during drag-and-drop operations on Linux/X11. Under specific conditions, invoking the upper-layer delegate can trigger synchronous destruction of the source window, which in turn recursively destroys the move loop object. When the call stack unwinds back to the outer execution of EndMoveLoop, member variables are dereferenced on the freed object, potentially leading to a control flow hijack.

Affected files:

  • ui/base/x/x11_whole_screen_move_loop.cc

Estimated timestamp from git blame: 2013-05-18

Detailed Writeup

Description

A potential Use-After-Free (UAF) vulnerability exists in X11WholeScreenMoveLoop::EndMoveLoop (ui/base/x/x11_whole_screen_move_loop.cc). The root cause is the absence of a WeakPtr guard or other lifetime checks after invoking an upper-layer delegate callback. Synchronous destruction of the source window during drag-and-drop operations can recursively free the X11WholeScreenMoveLoop instance, leading to subsequent dereferences of the freed object upon stack unwinding.

Root Cause Analysis

In ui/base/x/x11_whole_screen_move_loop.cc, the EndMoveLoop method executes the following cleanup:

C++
void X11WholeScreenMoveLoop::EndMoveLoop() {
  if (!in_move_loop_) {
    return;
  }
  ...
  nested_dispatcher_.reset();
  delegate_->OnMoveLoopEnded();               // (1) Can synchronously destroy |this|
  grab_input_window_events_.Reset();          // (2) UAF on |this|
  connection->DestroyWindow({grab_input_window_});   // (3) UAF read
  grab_input_window_ = x11::Window::None;     // (4) UAF write

  in_move_loop_ = false;                      // (5) UAF write
  std::move(quit_closure_).Run();             // (6) UAF read/run of OnceClosure
}

When delegate_->OnMoveLoopEnded() is called at line 240, control flows synchronously into the source window's delegate (X11Window). Under certain conditions, such as when the drag-and-drop destination is another window in the same Chrome process, event dispatching is short-circuited synchronously via XDragDropClient::SendXClientEvent's local window lookup.

If the target window's drag-exit handler or associated controller (e.g., during tab dragging or other system DnD operations) spins a nested, nestable event loop (such as base::RunLoop with kNestableTasksAllowed), queued tasks on the UI thread are permitted to execute. If a window closure task for the source window (CloseNow()) runs during this window, the destructor of X11Window is invoked.

Inside ~X11Window, the member variables are destroyed in reverse order of declaration. Since drag_loop_ (std::unique_ptr<X11MoveLoop>) is declared after drag_drop_client_ in x11_window.h, drag_loop_ is destroyed first. This invokes ~X11WholeScreenMoveLoop(), which calls EndMoveLoop() recursively. Because in_move_loop_ is still true (the outer call has not yet reached line 245), the recursive call proceeds, completes, and deletes/frees the X11WholeScreenMoveLoop instance.

When the synchronous call stack eventually unwinds back to the outer execution of EndMoveLoop() at line 240, execution resumes. However, the this pointer is now dangling, resulting in multiple UAF dereferences (lines 241-246). Most critically, executing std::move(quit_closure_).Run() on line 246 results in a virtual/indirect function call using the contents of a freed heap structure, which could potentially be exploited for Remote Code Execution (RCE) in the browser process.

(Note: As our analysis tools are static, these are potential steps and we do not have a working execution-based Proof of Concept).

Potential Trigger Steps (Conceptual)

  1. Initiate a drag-and-drop operation from Chrome Window A (source) on Linux/X11, which allocates X11WholeScreenMoveLoop.
  2. Move the cursor over Chrome Window B (target, in the same browser process) to associate the current target window.
  3. Terminate or cancel the move loop (e.g., via the Esc key), triggering EndMoveLoop().
  4. In the target's drag-leave flow (triggered synchronously via the same-process client short-circuit), cause the target to spin a nested, nestable run loop.
  5. In the nested run loop, dispatch a pending task that synchronously destroys Window A.
  6. The destruction of Window A recursively destroys the move loop object, which executes the inner EndMoveLoop and deletes the memory.
  7. As the outer call stack unwinds back to the original EndMoveLoop frame, it dereferences the freed memory.

Suggested Fix

To prevent this potential UAF, a WeakPtr guard should be checked after the delegate invocation. The class already owns a base::WeakPtrFactory<X11WholeScreenMoveLoop> weak_factory_{this}. We can check if this is still alive before executing the rest of the cleanups:

C++
  base::WeakPtr<X11WholeScreenMoveLoop> alive(weak_factory_.GetWeakPtr());
  delegate_->OnMoveLoopEnded();
  if (!alive) {
    return;
  }

This is identical to the pattern used in RunMoveLoop to handle synchronous deletion hazards.

Evaluated with Chrome root at commit: b5b015ea5f690560237d1f0cff1405844cd12b8d


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 absence of a WeakPtr guard or other lifetime check after invoking the upper-layer delegate callback, allowing synchronous destruction to recursively free the object before the remaining cleanup code runs.

Impact

The freed object is dereferenced, and running a closure from freed memory could potentially be exploited for remote code execution in the browser process, though the report notes no working proof of concept exists.

What the attacker needed

Linux/X11 environment; Two Chrome windows in the same process; User performs a drag-and-drop; Nested run loop during drag-leave

The fix

A WeakPtr guard should be checked after the delegate invocation, returning early if the object has been destroyed, matching the pattern already used in RunMoveLoop.

How it was found

  1. Start a drag-and-drop from a Chrome window on Linux/X11, allocating the move loop object.
  2. Move the cursor over another Chrome window in the same browser process.
  3. Cancel the move loop, for example with the Esc key, triggering EndMoveLoop.
  4. Cause the target window to spin a nested, nestable run loop during its drag-leave flow.
  5. In that nested loop, dispatch a pending task that destroys the source window.
  6. The source window destruction recursively frees the move loop, and the outer EndMoveLoop then dereferences 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.

A use-after-free happens when a program keeps using a piece of memory after it has been freed. Here, a drag-and-drop cleanup routine calls back into other code that can close the window, which frees the same cleanup object while it is still running. When the routine resumes, it reads and writes memory that no longer belongs to it, which can crash the browser or let an attacker take control.

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.