Use after free in Aura (CVE-2026-95315)
A use-after-free exists in WindowEventDispatcher::UpdateCapture because a capture-loss callback can synchronously destroy the widget and its dispatcher. An attacker who can cause such a callback could potentially corrupt memory or redirect control flow in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 4 months
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 WindowEventDispatcher::UpdateCapture. When a capture change is dispatched, the synchronous invocation of OnCaptureLost() can lead to widget destruction. If the widget is synchronously destroyed, the owning WindowEventDispatcher is deleted, resulting in UAF reads/writes upon returning to the method.
Affected files:
ui/aura/window_event_dispatcher.cc
Estimated timestamp from git blame: 2012-05-14
Root Cause Analysis
In ui/aura/window_event_dispatcher.cc, the method WindowEventDispatcher::UpdateCapture is responsible for updating mouse/pointer capture state. When transitioning capture away from an old window, the code synchronously dispatches capture loss to the old capture window's delegate:
void WindowEventDispatcher::UpdateCapture(Window* old_capture,
Window* new_capture) {
...
if (old_capture && old_capture->GetRootWindow() == window() &&
old_capture->delegate()) {
...
DispatchDetails details = DispatchEvent(old_capture, &event);
if (details.dispatcher_destroyed)
return;
if (!details.target_destroyed)
old_capture->delegate()->OnCaptureLost(); // Synchronous Re-entrancy Point
}
if (new_capture) {
if (mouse_moved_handler_ || Env::GetInstance()->IsMouseButtonDown())
mouse_moved_handler_ = new_capture; // Potential UAF write / read
} else {
DispatchDetails details = SynthesizeMouseMoveEvent(); // Potential UAF method call
if (details.dispatcher_destroyed) return;
}
mouse_pressed_handler_ = nullptr; // Potential UAF write
}
For desktop widgets on Linux (under X11 or Wayland), old_capture->delegate()->OnCaptureLost() propagates through DesktopNativeWidgetAura::OnCaptureLost() -> Widget::OnMouseCaptureLost() -> RootView::OnMouseCaptureLost().
Views are permitted to respond to capture loss by synchronously destroying the widget (e.g., calling Widget::CloseNow()). When this occurs, it initiates a synchronous destruction chain:
Widget::CloseNow()callsDesktopNativeWidgetAura::CloseNow(), which callsDesktopWindowTreeHostPlatform::CloseNow().- This triggers the platform window to close, executing
platform_window_delegate_->OnClosed(), leading toDesktopNativeWidgetAura::OnHostClosed(). OnHostClosed()resets thehost_unique pointer (host_.reset()), triggering the destruction of theWindowTreeHostinstance.- During destruction,
WindowTreeHost::DestroyDispatcher()is invoked, resettingdispatcher_(thestd::unique_ptrthat owns theWindowEventDispatcher).
At this point, the WindowEventDispatcher instance (this) is synchronously deleted. When the execution returns from OnCaptureLost(), the stack frames unwind back into UpdateCapture(), which proceeds to access and modify member fields (mouse_moved_handler_, mouse_pressed_handler_) or invoke SynthesizeMouseMoveEvent() on the now-freed this object.
Potential Steps to Trigger
Note: These are potential steps. Our analysis is based on static code review, as our tooling does not currently have the ability to run code or execute a live proof-of-concept.
- Create a View inside a desktop widget that requests and obtains mouse capture.
- Trigger an action (or simulated event) that forces a mouse capture transfer or release.
- In the View's
OnMouseCaptureLost()handler, synchronously callGetWidget()->CloseNow()to force widget destruction. - Observe that the platform host synchronously destroys the
WindowTreeHostand itsWindowEventDispatcherduring theOnCaptureLost()call stack. - Upon return from
OnCaptureLost(),UpdateCapture()continues execution, resulting in a Use-After-Free when accessing or writing to member variables of the deletedWindowEventDispatcher.
Impact
This is a potential Use-After-Free occurring in the unsandboxed browser process on desktop platforms.
- Memory Corruption: The assignment operators on
mouse_moved_handler_andmouse_pressed_handler_execute on a freed object structure. Since these areraw_ptrobjects, writing to them on freed memory can corrupt the allocator state. - Control Flow Hijack: When
new_captureis null,SynthesizeMouseMoveEvent()is called, accessinghost_(which is already deleted) and executing virtual functions, potentially allowing for control flow redirection if the freed memory is reclaimed and groomed.
Suggested Fix
To remediate this issue, implement a liveness check immediately following the re-entrant OnCaptureLost() call using the class's existing weak_ptr_factory_:
base::WeakPtr<WindowEventDispatcher> weak_this = weak_ptr_factory_.GetWeakPtr();
if (!details.target_destroyed)
old_capture->delegate()->OnCaptureLost();
if (!weak_this)
return;
Evaluated with Chrome root at commit: 5133b93d189b383c37805b1cf3a9d2dbfe8d7379
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
The code calls a delegate callback that can synchronously destroy the WindowEventDispatcher, then continues to use its member fields without checking whether the object still exists.
Impact
This could allow memory corruption or control flow hijack in the unsandboxed browser process, though the report is based on static analysis and no live proof-of-concept was executed.
What the attacker needed
Desktop widget on Linux (X11 or Wayland); a View that obtains mouse capture; a capture-loss handler that destroys the widget
The fix
The issue should be fixed by adding a liveness check using the existing weak pointer factory immediately after the re-entrant OnCaptureLost() call.
How it was found
- Create a View inside a desktop widget that requests and obtains mouse capture.
- Trigger an action that forces a mouse capture transfer or release.
- In the View's OnMouseCaptureLost() handler, synchronously call GetWidget()->CloseNow() to force widget destruction.
- Observe that the platform host synchronously destroys the WindowTreeHost and its WindowEventDispatcher during the OnCaptureLost() call stack.
- Upon return from OnCaptureLost(), UpdateCapture() continues execution, resulting in a Use-After-Free when accessing or writing to member variables of the deleted WindowEventDispatcher.
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 callback during mouse capture handling can close the window, which deletes the object that is still running code, so later lines touch freed memory. This could let an attacker corrupt memory or hijack control flow.
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.