Use after free in Aura (CVE-2026-79200)
A use-after-free was reported in the browser process of Aura-based platforms: calling SetCapture during mouse locking can synchronously destroy the capture window and its event handler, leaving dangling pointers that are later read and used for a virtual call. If an attacker reclaims the freed memory, the report claims this could lead to control-flow hijack and arbitrary code execution in the unsandboxed browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 48 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 vulnerability exists in the browser process of Aura-based platforms due to reentrant window destruction during mouse locking. Invoking SetCapture() can synchronously delete the capture window and its associated event handler during touch cancellation. This can result in a Use-After-Free when the deleted window or event handler is subsequently accessed.
Affected files:
ui/aura/window_tree_host_platform.cccontent/browser/renderer_host/render_widget_host_view_event_handler.ccui/aura/window_tree_host.cc
Estimated timestamp from git blame: 2021-07-02
Potential Use-After-Free in WindowTreeHostPlatform::LockMouse and RenderWidgetHostViewEventHandler
Description and Root Cause
A potential Use-After-Free (UAF) vulnerability exists in the browser process of Aura-based platforms (such as Linux, ChromeOS, and Fuchsia). The issue arises due to synchronous, reentrant window and view destruction during pointer locking.
Specifically, in WindowTreeHostPlatform::LockMouse (ui/aura/window_tree_host_platform.cc:226):
void WindowTreeHostPlatform::LockMouse(Window* window) {
window->SetCapture();
WindowTreeHost::LockMouse(window);
}
Calling window->SetCapture() can trigger a synchronous touch-cancellation flow via the gesture recognizer (ui/events/gestures/gesture_recognizer_impl.cc), which dispatches synthetic touch-cancel events (EventType::kTouchCancelled) to other active gesture consumers.
If a touch-cancel handler on another window synchronously destroys the requesting tab's WebContents (e.g., closing a popup/dropdown or destroying the tab's container), the target RenderWidgetHostViewAura view and its associated RenderWidgetHostViewEventHandler will be synchronously deleted.
When control returns to WindowTreeHostPlatform::LockMouse, the stack parameter window is now a dangling pointer. Furthermore, when execution returns to RenderWidgetHostViewEventHandler::LockPointer (content/browser/renderer_host/render_widget_host_view_event_handler.cc:151), both this and window_ are dangling:
window_->GetHost()->LockMouse(window_);
if (ShouldMoveToCenter(unlocked_global_mouse_position_)) // UAF read on this->unlocked_global_mouse_position_
MoveCursorToCenter(nullptr);
delegate_->SetTooltipsEnabled(false); // UAF dereference and virtual function call on this->delegate_
The subsequent call to delegate_->SetTooltipsEnabled(false) constitutes a virtual method call on a pointer (delegate_) read from freed memory. If an attacker reclaims this heap allocation before this line, it can lead to control-flow hijack and arbitrary code execution in the context of the unsandboxed browser process.
Affected Platforms
- Linux, ChromeOS, and Fuchsia (Aura-based platforms).
- Windows is unaffected because
DesktopWindowTreeHostWin::LockMousedoes not callSetCapture().
Potential Trigger Steps
Because our tooling agent does not currently have the ability to run or execute code, these are potential steps to trigger the issue:
- Setup active touch state: Arrange the browser UI state such that a gesture consumer on another window has an active touch.
- Initiate mouse lock: From the renderer process, trigger a pointer-lock request (e.g., via
element.requestPointerLock()). - Handle touch cancellation synchronously: When the gesture recognizer dispatches
EventType::kTouchCancelledto the other consumer window during theSetCapture()call, its event handler must synchronously close or destroy the target WebContents/tab (for example, by dismissing an anchored popup bubble that owns or is bound to the target view). - Trigger UAF: On shipping channels <= M151 (prior to M152 where a diagnostic
CHECKwas introduced), the deletion of theRenderWidgetHostViewEventHandlerproceeds silently, and control returns to trigger the Use-After-Free reads and the virtual call dereference.
Suggested Fix
To resolve this issue, lifetime tracking should be introduced in both WindowTreeHostPlatform::LockMouse and RenderWidgetHostViewEventHandler::LockPointer to guard against reentrant destruction.
- In
WindowTreeHostPlatform::LockMouse, track theWindowlifetime using abase::WeakPtr<aura::Window>orWindowTracker:
void WindowTreeHostPlatform::LockMouse(Window* window) {
base::WeakPtr<Window> window_weak = window->GetWeakPtrAsWindow();
window->SetCapture();
if (!window_weak)
return;
WindowTreeHost::LockMouse(window);
}
- In
RenderWidgetHostViewEventHandler::LockPointer, similarly track the lifetime ofthisandwindow_after the reentrant call:
base::WeakPtr<RenderWidgetHostViewEventHandler> weak_this = weak_ptr_factory_.GetWeakPtr();
window_->GetHost()->LockMouse(window_);
if (!weak_this)
return blink::mojom::PointerLockResult::kUnknown; // Or appropriate error
if (ShouldMoveToCenter(unlocked_global_mouse_position_))
MoveCursorToCenter(nullptr);
delegate_->SetTooltipsEnabled(false);
Evaluated with Chrome root at commit: 84065d9121f6e48f67755f0ae963cc09617e5c85
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 a reentrant call during SetCapture synchronously destroys the window and event handler, and the calling code does not re-check their lifetime before continuing to use them.
Impact
Could allow control-flow hijack and arbitrary code execution in the unsandboxed browser process if the freed allocation is reclaimed, though the report notes the trigger steps are potential and were not executed.
What the attacker needed
Aura-based platform (Linux, ChromeOS, Fuchsia); Active touch on another gesture consumer; Renderer can request pointer lock; Touch-cancel handler destroys the target tab
The fix
Lifetime tracking with weak pointers should be added in both LockMouse and LockPointer so execution stops if the window or handler was destroyed reentrantly.
How it was found
- Arrange for a gesture consumer on another window to have an active touch.
- From the renderer, request pointer lock, for example through the element pointer lock API.
- During SetCapture, have the touch-cancel handler synchronously close or destroy the target tab or WebContents.
- On channels up to M151, the handler is deleted silently and control returns to the use-after-free reads and virtual call.
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 a piece of memory but keeps using it, that is called a use-after-free. Here, locking the mouse can trigger a chain of events that closes the very window the code is still working with, so the code then reads and calls through memory that no longer belongs to it. An attacker who can place their own data in that freed memory might redirect the program's execution.
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.