Use after free in Views (CVE-2026-15111)
A use-after-free was reported in Widget::SetCapture in Chromium's Views code, where a reentrant call to the native widget's SetCapture can synchronously destroy the widget, leaving a dangling this pointer. An attacker with a compromised renderer could then reclaim the freed memory and potentially hijack virtual calls in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 42 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 Widget::SetCapture due to reentrant, synchronous destruction of the Widget during the native_widget_->SetCapture() call. If the widget is synchronously closed/deleted during nested event dispatch or touch cancellation, control flow returns to a dangling this pointer in Widget::SetCapture. This can lead to subsequent memory corruption, UAF writes, and virtual method hijacking in the browser process.
Affected files:
ui/views/widget/widget.cc
Estimated timestamp from git blame: 2014-07-17
Problem Description
A potential Use-After-Free (UAF) vulnerability exists in Widget::SetCapture (located in ui/views/widget/widget.cc). The method calls native_widget_->SetCapture() to initiate native input capture, but does not verify whether this is still alive after the call.
During the synchronous, reentrant execution of native_widget_->SetCapture(), the underlying Widget can be synchronously destroyed. This can happen through synchronous touch-cancel or gesture event dispatch:
- In Aura-based window systems,
CaptureController::SetCapture(orDesktopCaptureClient::SetCapture) invokesGestureRecognizer::CancelActiveTouchesExcept(new_capture_window). This synchronously dispatches synthetic touch-cancel/gesture-end events to other windows. If the target widget (or its event handlers) reacts by closing itself, theWidgetis synchronously deleted under the defaultNATIVE_WIDGET_OWNS_WIDGETownership model.
Once the Widget is destroyed, control flow unwinds back to Widget::SetCapture. At this point, this is a dangling pointer pointing to freed memory. The function then performs multiple operations using the freed memory:
- Line 1622: Loads
this->native_widget_(abase::WeakPtr) and calls the virtualHasCapture(). If the memory has been reclaimed or corrupted, this leads to a virtual method call on an attacker-influenced pointer. - Line 1627: Writes to
this->is_mouse_button_pressed_(a 1-byte write into freed memory) and calls virtualIsMouseButtonDown()through the dangling pointer. - Line 1628: Loads
this->root_view_(astd::unique_ptr) and invokes the virtualSetMouseAndGestureHandler()on it.
Note that MiraclePtr (BackupRefPtr) provides no protection here because this is a bare stack pointer, and the dangerous loads/writes are performed on fields stored inside the freed object, not through a raw_ptr<> pointing to it.
Vulnerable Code
// ui/views/widget/widget.cc:1613-1629
void Widget::SetCapture(View* view) {
if (!native_widget_) {
return;
}
if (!native_widget_->HasCapture()) {
native_widget_->SetCapture(); // <--- Reentrant call can synchronously destroy `this`
// Early return if setting capture was unsuccessful.
if (!native_widget_->HasCapture()) { // <--- UAF read and virtual call
return;
}
}
is_mouse_button_pressed_ = native_widget_->IsMouseButtonDown(); // <--- UAF write and virtual call
root_view_->SetMouseAndGestureHandler(view);
}
Potential Steps to Trigger
Since our analysis is static and our tooling does not yet have the ability to run code, these are potential steps an attacker would follow to trigger the vulnerability:
- A compromised renderer process initiates a multi-touch session, targeting a pop-up window or dialog owned by a specific browser-side
Widget. - The renderer dispatches a sequence of events (e.g., drag-and-drop or gesture event sequences) that forces the browser process to call
Widget::SetCaptureto capture future inputs. - During the capture change, the browser window manager triggers
CancelActiveTouchesExcept()to cancel outstanding touch inputs on the window. - The synthetic touch cancel events propagate to pre-target event handlers, which respond by immediately closing the active widget (e.g., via
Widget::CloseNow()). - When the closed widget is synchronously deleted mid-call, control returns to
Widget::SetCapturewith a danglingthispointer. - The attacker reclaims the freed
Widgetmemory allocation in the browser process heap (for example, by loading specific media, images, or large strings) to overwrite the object's memory with controlled data, gaining control over virtual table pointers or smart pointer structures to hijack control flow.
Proposed Fix
To prevent this vulnerability, Widget::SetCapture should check whether the widget was destroyed during the synchronous call, similar to how it is handled in Widget::OnMouseEvent using a WidgetDeletionObserver:
void Widget::SetCapture(View* view) {
if (!native_widget_) {
return;
}
if (!native_widget_->HasCapture()) {
WidgetDeletionObserver native_widget_observer(this);
native_widget_->SetCapture();
if (!native_widget_observer.IsWidgetAlive()) {
return;
}
// Early return if setting capture was unsuccessful.
if (!native_widget_->HasCapture()) {
return;
}
}
is_mouse_button_pressed_ = native_widget_->IsMouseButtonDown();
root_view_->SetMouseAndGestureHandler(view);
}
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
Likely the method does not check whether the widget was destroyed during the synchronous, reentrant native SetCapture call before continuing to use this.
Impact
This could lead to memory corruption and virtual method hijacking in the browser process, though the report is based on static analysis and the steps are only potential.
What the attacker needed
Compromised renderer process; multi-touch or gesture input support
The fix
The method should use a WidgetDeletionObserver to check whether the widget is still alive after the native SetCapture call and return early if it was destroyed.
How it was found
- A compromised renderer starts a multi-touch session against a browser-side widget.
- The renderer sends events that make the browser call Widget::SetCapture.
- The capture change triggers cancellation of outstanding touches on the window.
- Synthetic touch-cancel events reach handlers that close the widget immediately.
- The widget is deleted mid-call and control returns to SetCapture with a dangling pointer.
- The attacker reclaims the freed memory to try to control virtual table pointers.
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 an object but keeps using it, that is a use-after-free. Here, a function asks the window system to grab input, and during that request the window can be closed and deleted, yet the function carries on using the now-deleted object. If an attacker can put their own data in that freed memory, they may be able to steer the program's next steps.
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.