Use after free in Views (CVE-2026-13802)
A use-after-free vulnerability was identified in the menu controller code when opening a submenu, where synchronous OS events can destroy the menu tree while a raw pointer to the menu item remains on the stack. An attacker could potentially exploit this to achieve remote code execution in the browser process by hijacking virtual method calls on the 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 without the Chrome Security team.
Overview: A potential Use-After-Free vulnerability exists in MenuController::OpenMenuImpl when opening a submenu. Synchronous OS events during the submenu's display can cause the menu tree and controller to be destroyed while a raw pointer to the menu item is still on the stack. Resuming execution leads to virtual method calls on the freed memory, which may allow arbitrary code execution in the browser process.
Affected files:
ui/views/controls/menu/menu_controller.ccui/views/controls/menu/menu_runner_impl.ccui/views/controls/menu/submenu_view.ccui/views/controls/menu/menu_host.cc
Estimated timestamp from git blame: 2025-08-20
Summary
A potential Use-After-Free (UAF) vulnerability has been identified in MenuController::OpenMenuImpl (ui/views/controls/menu/menu_controller.cc). When a submenu is opened, a call to ShowAt() can synchronously pump OS events (particularly on macOS). If a window destruction or focus change event is processed during this nested loop, the entire menu tree and MenuController are deleted. Because the menu item is tracked via a raw C++ pointer on the stack, MiraclePtr protections are bypassed, and subsequent virtual method calls on the freed object can be hijacked to achieve Remote Code Execution (RCE) in the Browser Process.
Technical Details
MenuController::OpenMenuImpl(MenuItemView* item, ...)receivesitemas a standard C++ raw pointer on the stack.- The code calls
item->GetSubmenu()->ShowAt(params), which propagates down toMenuHost::ShowMenuHostand callsShowInactive(). - On macOS,
ShowInactive()interacts with native window APIs (-[NSWindow addChildWindow:ordered:]) that can synchronously dispatch OS events like window focus loss or destruction. - If an attacker triggers a window destruction or focus change at this exact moment,
MenuRunnerImpl::OnMenuClosedis invoked synchronously. MenuRunnerImplexecutesdelete controller_.get();(destroying theMenuController, which isthisinOpenMenuImpl) and thendelete this;(destroying theMenuRunnerImpland its uniquely ownedMenuItemViewtree).- During this teardown, all heap-based
raw_ptrreferences to theitemallocation are cleanly destroyed, causing the MiraclePtr (BackupRefPtr) reference count to drop to zero. The memory is immediately freed to the system allocator. - Execution unwinds and returns to
OpenMenuImplimmediately after theShowAt()call. - The code continues executing using the now-dangling
itemstack variable, evaluatingitem->GetSubmenu()->GetWidget(). - This performs a non-virtual fetch of the forged
submenu_pointer and invokes the virtual methodGetWidget()(ui/views/view.h), allowing an attacker to hijack the control flow via a forged vtable.
Potential Steps to Trigger
Note: Our tooling agent does not currently have the ability to run code, so these are suggested steps based on static analysis, lacking a working Proof-of-Concept.
- An attacker serves a malicious web page that opens a Views-based menu (e.g., via a browser extension popup or custom UI element interaction).
- The attacker programmatically triggers a submenu to open.
- Racing the submenu's
ShowAtsequence, the attacker triggers an event that causes the parent window to close or lose focus (e.g., popping under another window or destroying the popup). - The nested event loop processes the focus loss, synchronously destroying the menu.
- The attacker sprays the browser process heap to reclaim the freed
MenuItemViewandSubmenuViewmemory with forged objects containing a malicious vtable. - When
ShowAtreturns, the browser dereferences the attacker's vtable, achieving RCE.
Suggested Fix
To safely handle synchronous destruction, OpenMenuImpl should detect if the MenuController or the MenuItemView was destroyed during the ShowAt call.
-
Obtain a weak pointer to the controller:
base::WeakPtr<MenuController> weak_this = weak_factory_.GetWeakPtr(); -
Use a
views::ViewTrackeror abase::WeakPtr<MenuItemView>(sinceViewsupports weak pointers) to track theitem. -
After the
item->GetSubmenu()->ShowAt(params)call, verify liveness:C++ if (!weak_this || !weak_item) { return; }
Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; 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 does not check whether the menu controller or menu item was destroyed during a synchronous call that can process OS events, leading to use of a dangling raw pointer.
Impact
An attacker could potentially achieve remote code execution in the browser process, though the report notes that the steps are based on static analysis and lack a working proof-of-concept.
What the attacker needed
Attacker serves a malicious web page; browser uses Views-based menu; attacker can trigger submenu open; race condition with window events
The fix
The code should be fixed by checking whether the menu controller or menu item was destroyed during the ShowAt call, using weak pointers or a view tracker.
How it was found
- An attacker serves a malicious web page that opens a Views-based menu.
- The attacker programmatically triggers a submenu to open.
- Racing the submenu's ShowAt sequence, the attacker triggers an event that causes the parent window to close or lose focus.
- The nested event loop processes the focus loss, synchronously destroying the menu.
- The attacker sprays the browser process heap to reclaim the freed memory with forged objects containing a malicious vtable.
- When ShowAt returns, the browser dereferences the attacker's vtable, achieving RCE.
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.
This report describes a memory safety bug in a web browser's menu system. When a submenu opens, the code holds a direct reference (a raw pointer) to the menu item. If certain system events happen at the same time, the menu can be destroyed, leaving that reference pointing to freed memory. Later, the code uses that dangling reference to call a function, which an attacker could manipulate to run their own 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.