Use after free in Views (CVE-2026-78983)
A potential use-after-free exists in Widget::Show() and Widget::ShowInactive() because there is no guard after native_widget_->Show() returns. A malicious observer or compromised renderer could synchronously destroy the Widget during the native call, leading to member writes and virtual method calls on freed memory.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 3 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 vulnerability exists in Widget::Show() and Widget::ShowInactive() due to a missing WeakPtr guard after returning from native_widget_->Show(). During synchronous Win32 window message dispatch, observer notifications can be synchronously processed, allowing a malicious observer or compromised renderer IPC to destroy the Widget. Upon return, the code continues to perform member writes and virtual method calls on the freed Widget instance.
Affected files:
ui/views/widget/widget.ccui/views/widget/widget.h
Estimated timestamp from git blame: 2025-09-04
Detailed Description
A potential Use-After-Free (UAF) vulnerability exists in Widget::Show() and Widget::ShowInactive() (ui/views/widget/widget.cc) due to the lack of safety checks after invoking native_widget_->Show().
On Windows, native_widget_->Show() triggers synchronous OS calls such as ::ShowWindow() or ::SetWindowPos() (via SetFullscreen()). These Win32 APIs synchronously dispatch window messages (e.g., WM_WINDOWPOSCHANGED) directly to the window's procedure HWNDMessageHandler::OnWndProc on the UI thread.
When processing these messages, HWNDMessageHandler::OnWindowPosChanged invokes delegate_->HandleVisibilityChanged(true), which routes to Widget::OnNativeWidgetVisibilityChanged().
Crucially, unlike OnNativeWidgetSizeChanged(), OnNativeWidgetVisibilityChanged() does not instantiate a ScopedCallStackLock. This means the security assertion CHECK(!on_call_stack_) inside Widget::~Widget() is not triggered if destruction is initiated. If a registered WidgetObserver responds to the visibility change by synchronously invoking Widget::CloseNow(), the window is synchronously destroyed.
Because the browser window has CLIENT_OWNS_WIDGET ownership, the destruction flow synchronously deletes both the DesktopWindowTreeHostWin and the parent Widget / BrowserWidget instances.
When the synchronous message dispatch completes, control unwinds back to the in-flight execution frames of DesktopWindowTreeHostWin::Show() and Widget::Show(). Since both instances have been deallocated, this results in a cascade of Use-After-Frees:
- In
DesktopWindowTreeHostWin::Show(): Line 344 attempts to callGetWidget()->CanActivate()on the deleted host. - In
Widget::Show(): Line 1082 performs a member write (saved_show_state_ = preferred_show_state;) on the freedWidgetallocation. - In
Widget::Show(): Line 1087 callsHandleShowRequested(), which dereferences the freedsublevel_manager_unique pointer to executeEnsureOwnerSublevel()on a reclaimed pointer.
Note that since our tooling agent does not yet have the capability to execute code in a live environment, these findings represent a potential vulnerability and the trigger steps are theoretical.
Suggested Potential Trigger Steps
- An attacker-controlled extension or a compromised renderer initiates the creation of a popup window with
state: 'fullscreen'. - The browser process maps the initial show state to
ui::mojom::WindowShowState::kFullscreenand initiates the first-show of theBrowserWidget. - The attacker immediately triggers a window close action (or registers a
WidgetObserverthat reacts to the first visibility/activation notification). - During
Widget::Show(),native_widget_->Show(kFullscreen)invokes Win32 synchronous window repositioning. - The synchronous visibility change event dispatches, triggering the registered observer to synchronously call
Widget::CloseNow(). - The
Widgetand host objects are freed. The call stack returns toWidget::Show(), resulting in a member write and virtual method dereference on the freed allocations.
Proposed Fix
To remediate this issue, introduce a WeakPtr guard in both Widget::Show() and Widget::ShowInactive() immediately before calling native_widget_->Show(...), and return early if the widget was destroyed during the native call. This aligns with the sibling guard pattern used in Widget::SetFullscreen().
void Widget::Show() {
if (!native_widget_) {
return;
}
...
auto weak_ptr = GetWeakPtr();
if (non_client_view_) {
if (saved_show_state_ == ui::mojom::WindowShowState::kMaximized &&
!initial_restored_bounds_.IsEmpty() && !IsFullscreen()) {
native_widget_->Show(ui::mojom::WindowShowState::kMaximized,
initial_restored_bounds_);
} else {
native_widget_->Show(saved_show_state_, gfx::Rect());
}
} else {
native_widget_->Show(preferred_show_state, gfx::Rect());
}
if (!weak_ptr) {
return;
}
if (non_client_view_) {
saved_show_state_ = preferred_show_state;
}
HandleShowRequested();
}
Evaluated with Chrome root at commit: 87214e6721f6c34afd9181b80769a24c0c601c50
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 absence of a WeakPtr guard after native_widget_->Show() allows synchronous observer callbacks to destroy the Widget, so subsequent member writes and virtual calls operate on freed memory.
Impact
A malicious observer or compromised renderer could potentially cause a use-after-free, which may lead to memory corruption or code execution, though the report notes the trigger steps are theoretical.
What the attacker needed
Attacker-controlled extension or compromised renderer; ability to create a popup window with fullscreen state; ability to trigger a synchronous close during show
The fix
A WeakPtr guard should be added in Widget::Show() and Widget::ShowInactive() before calling native_widget_->Show(), returning early if the widget was destroyed during the native call.
How it was found
- An attacker-controlled extension or compromised renderer creates a popup window with fullscreen state.
- The browser process maps the show state to fullscreen and initiates the first show of the BrowserWidget.
- The attacker triggers a window close action or registers a WidgetObserver that reacts to the first visibility notification.
- During Widget::Show(), native_widget_->Show(kFullscreen) invokes synchronous Win32 window repositioning.
- The synchronous visibility change event dispatches, and the observer synchronously calls Widget::CloseNow().
- The Widget and host objects are freed, and the call stack returns to Widget::Show(), causing a member write and virtual method dereference on freed allocations.
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 memory after it has been freed. Here, showing a window can trigger a chain of events that destroys the window object, but the code then carries on using it as if it still existed. This could let an attacker who can influence those events cause crashes or possibly run harmful 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.