Use after free in Journeys (CVE-2026-13853)
A use-after-free exists in the browser process because HistoryClustersHandler caches a raw TabInterface pointer in a std::variant, bypassing MiraclePtr protection. When a popup is converted to a tab, the TabInterface is destroyed but the handler persists, allowing a compromised renderer to hijack control flow via Mojo IPC.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 19 days
Flapjack, 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 Use-After-Free vulnerability exists in the browser process due to HistoryClustersHandler caching a tabs::TabInterface pointer inside a std::variant. This structure bypasses MiraclePtr protections. When a popup window is converted to a tab, the TabInterface is destroyed but the handler persists, allowing a compromised renderer to hijack control flow via Mojo IPC.
Affected files:
chrome/browser/ui/webui/history_clusters/history_clusters_handler.hchrome/browser/ui/webui/history_clusters/history_clusters_handler.ccchrome/browser/ui/webui/history/history_ui.cc
Estimated timestamp from git blame: 2024-08-30
Root Cause
In chrome/browser/ui/webui/history_clusters/history_clusters_handler.h, the interface_ field caches context information for the handler. It is defined as a std::variant holding raw pointers:
using ContextInterface = std::variant<BrowserWindowInterface*, tabs::TabInterface*>;
ContextInterface interface_;
Because standard raw pointers are used inside the std::variant, Chromium's MiraclePtr (BackupRefPtr) rewrite tooling cannot protect them. If either pointer becomes dangling, dereferencing it leads to an immediate Use-After-Free (UAF) rather than a safe crash.
Vulnerability Details
The UAF occurs when the chrome://history WebUI is opened in a non-normal window (like a popup) and is subsequently moved to a normal tabbed browser window.
Potential Attacker Steps:
- Precondition: An attacker exploits a renderer bug to gain code execution in a process hosting the
chrome://historyWebUI. - The WebUI is loaded inside a popup window. During initialization,
HistoryUI::BindInterfaceretrieves thetabs::TabInterface*for the currentWebContentsand passes it to theHistoryClustersHandlerconstructor, which caches it in theinterface_variant. - The popup window is converted to a tabbed browser (e.g., via the "Show as tab" action,
ConvertPopupToTabbedBrowser). - This action calls
TabStripModel::DetachWebContentsAtForInsertion, which in turn callstabs::TabModel::DestroyAndTakeWebContents. DestroyAndTakeWebContentssafely moves theWebContentsout of theTabModeland then explicitly destroys theTabModel(which implementstabs::TabInterface).- Because the
WebContentssurvives, the associatedHistoryUIandHistoryClustersHandleralso survive. However,HistoryClustersHandlerdoes not observeTabInterfacedestruction, leavinginterface_as a dangling pointer to the freedTabModel. - The attacker sprays the browser heap to replace the freed
TabModelwith controlled data, including a fake vtable. - The attacker sends a Mojo IPC message over the
mojom::PageHandlerinterface (e.g.,OpenVisitUrlsInTabGrouporShowContextMenuForURL). - In
history_clusters_handler.cc, these IPC handlers callGetBrowserWindowInterface(interface_). - The helper function executes
std::get<tabs::TabInterface*>(interface)->GetBrowserWindowInterface(). This makes a virtual function call on the freed memory, dereferencing the attacker's fake vtable and resulting in arbitrary code execution in the browser process.
Note: These steps trace the code paths theoretically available; our tooling has not executed a working exploit.
Suggested Fix
- Adopt MiraclePtr: Change the
ContextInterfacealias to useraw_ptrto ensure MiraclePtr protection:C++ using ContextInterface = std::variant<raw_ptr<BrowserWindowInterface>, raw_ptr<tabs::TabInterface>>; - Lifetime Observation:
HistoryClustersHandlershould properly observe the lifetime of theTabInterface. Since it accepts aTabInterface*in its constructor, it should register for destruction notifications (e.g., usingtabs::TabInterface::RegisterWillDetach) and clear the pointer or prevent further Mojo processing when the tab detaches or is destroyed.
Evaluated with Chrome root at commit: 2155cb00003ec35716a76ed3246eae995f87b7ff
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
The handler stores raw pointers inside a std::variant, which MiraclePtr cannot protect, and it does not observe the TabInterface lifetime, so the pointer dangles after the tab is destroyed.
Impact
A compromised renderer could achieve arbitrary code execution in the browser process, though the report notes the steps are theoretical and no working exploit was executed.
What the attacker needed
Renderer code execution; chrome://history opened in a popup; popup converted to a tab
The fix
The handler should use raw_ptr in the variant and observe TabInterface destruction to clear the pointer or stop Mojo processing.
How it was found
- Load the chrome://history WebUI inside a popup window so the handler caches the TabInterface pointer.
- Convert the popup to a tabbed browser, which destroys the TabModel implementing TabInterface while the WebContents and handler survive.
- Spray the browser heap to replace the freed TabModel with controlled data including a fake vtable.
- Send a Mojo IPC message such as OpenVisitUrlsInTabGroup or ShowContextMenuForURL to the handler.
- The handler calls GetBrowserWindowInterface on the dangling pointer, making a virtual call through the fake vtable.
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 pointer to memory it has already freed and later uses it. Here, a browser component remembers a tab object that gets destroyed when a popup becomes a normal tab, so later messages can make the browser call into freed memory. An attacker who already controls a renderer process could use this to run code in the more privileged browser process.
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.