Use after free in Views (CVE-2026-87633)
A use-after-free was reported in the Views menu controller: after a re-entrant call that can synchronously destroy the menu item tree, the code checks only its own liveness and then dereferences a raw menu item pointer. An attacker could potentially trigger a crash or memory corruption on the browser UI thread, though the report is based on static analysis only.
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 (UAF) vulnerability exists in MenuController::OpenMenuImpl when a nested menu context triggers synchronous destruction of the underlying MenuItemView tree during a ShowAt call. While the controller verifies its own liveness via a WeakPtr check, it fails to perform any validation on the bare stack parameter MenuItemView* item before dereferencing it. This can lead to a UAF read and subsequent memory corruption on the UI thread in the browser process.
Affected files:
ui/views/controls/menu/menu_controller.cc
Estimated timestamp from git blame: 2018-06-21
Description
A potential Use-After-Free (UAF) vulnerability has been identified in MenuController::OpenMenuImpl (ui/views/controls/menu/menu_controller.cc). The issue occurs because the code does not verify the liveness of the raw stack parameter MenuItemView* item after returning from a re-entrant call that can synchronously destroy the MenuItemView tree.
Root Cause Analysis
In MenuController::OpenMenuImpl, the following sequence takes place:
auto weak_this = AsWeakPtr();
item->GetSubmenu()->ShowAt(params); // Re-entrancy point
// ...
CHECK(weak_this); // Guards `this` ONLY
if (item->GetSubmenu()->GetWidget()) {
const gfx::Point mouse_pos = ConvertFromScreen(
*item->submenu_, display::Screen::Get()->GetCursorScreenPoint());
// ...
}
When ShowAt() is called, it initializes and shows the MenuHost widget. On certain platforms or under specific window configurations, showing this widget can synchronously trigger focus-change cascades or native window deactivations. This can cause the owner of the nested/inner MenuRunner to synchronously delete it.
Because the inner menu runner does not own the MenuController (i.e., owns_controller_ is false), it calls controller_->Cancel(MenuController::ExitType::kDestroyed):
- In
MenuController::ExitMenu(), becauseexit_type_iskDestroyed(rather thankAll), recursion to the outer delegate is skipped, keeping the mainMenuControlleralive. - The inner runner's
OnMenuClosed()executesdelete thisto destroy itself synchronously, which deallocates its ownedMenuItemViewtree. - When execution resumes after
ShowAt(),CHECK(weak_this)passes successfully because the controller is still alive. - The code immediately dereferences the raw pointer
itemto access the submenu and widget, resulting in a Use-After-Free read of the freedMenuItemView(and itssubmenu_member).
Since item is a raw pointer on the stack, it is not protected by MiraclePtr (BackupRefPtr).
Potential Steps to Reproduce
Note: These steps are theoretical and based on static analysis; our tooling does not currently have the capability to execute code or verify live exploits.
- Display a top-level views-based menu containing a submenu item.
- Trigger a nested context menu (e.g., via simulated right-click on a bookmark item) using a secondary
MenuRunnerthat registers as a nested delegate on the activeMenuController. - Force a synchronous window deactivation or focus shift precisely during the nested widget's initialization within
ShowAt(). - Observe if the nested
MenuRunneris synchronously released and destroyed, deallocating theMenuItemViewtree while the outerMenuControllercontinues execution. - The execution resumes in
OpenMenuImpland accesses the freeditempointer, causing a crash or memory corruption.
Suggested Remediation
To remediate this issue, the liveness of the MenuItemView must be validated before it is accessed after the re-entrancy point.
Since MenuItemView inherits from views::View, a standard views::ViewTracker can be used to safely track the lifetime of the item across the synchronous call:
auto weak_this = AsWeakPtr();
views::ViewTracker item_tracker(item);
item->GetSubmenu()->ShowAt(params);
CHECK(weak_this);
if (!item_tracker.view()) {
return; // Abort if the menu item was synchronously destroyed.
}
Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8
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 code validates the controller's own lifetime with a weak pointer but never checks whether the raw MenuItemView pointer survived a re-entrant ShowAt call that can synchronously destroy the item tree.
Impact
This could lead to a use-after-free read and subsequent memory corruption on the UI thread in the browser process, but the steps are theoretical and unverified.
What the attacker needed
User opens a menu with a submenu; nested menu shown via secondary runner; synchronous focus or deactivation event
The fix
The item's lifetime should be tracked with a ViewTracker and the function should return early if the view was destroyed during the call.
How it was found
- Display a top-level views-based menu containing a submenu item.
- Trigger a nested context menu using a secondary MenuRunner that registers as a nested delegate.
- Force a synchronous window deactivation or focus shift during the nested widget's initialisation.
- Observe whether the nested MenuRunner is synchronously destroyed, freeing the MenuItemView tree.
- Execution resumes in OpenMenuImpl and accesses the freed item pointer.
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 a reference to memory it has already released and then reads or writes through it. Here, showing a nested menu can cause the menu item to be deleted while the code still holds a pointer to it, so the next access touches freed memory. The report is theoretical: nobody has actually run an exploit.
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.