Use after free Core (CVE-2026-12007)
A use-after-free exists in the Windows DirectManipulationHelper class because a synchronous COM call can pump a nested message loop that destroys the helper. An attacker who grooms the heap could potentially hijack virtual calls and achieve remote code execution in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 17 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 the Windows-specific DirectManipulationHelper class during window reparenting or teardown. Synchronous COM calls inside UpdateEventHandler can spin a nested message loop on the UI thread, allowing a pending destruction message to re-entrantly destroy the helper. Subsequent execution on the deallocated helper results in a write-after-free and controlled virtual function calls on freed COM interface pointers.
Affected files:
content/browser/renderer_host/direct_manipulation_helper_win.cccontent/browser/renderer_host/direct_manipulation_helper_win.h
Estimated timestamp from git blame: 2025-07-09
Root Cause Analysis
In content/browser/renderer_host/direct_manipulation_helper_win.cc, the function DirectManipulationHelper::UpdateEventHandler manages registering and unregistering viewport event handlers:
void DirectManipulationHelper::UpdateEventHandler(
base::WeakPtr<aura::WindowTreeHost> window_tree_host,
ui::WindowEventTarget* event_target) {
...
if (event_handler_) {
event_handler_.Reset();
viewport_->Stop(); // :169 Synchronous COM call
viewport_->RemoveEventHandler(view_port_handler_cookie_);// :170 Use-After-Free (UAF)
}
window_tree_host_ = window_tree_host; // :173 Write-After-Free
event_target_ = event_target; // :174 Write-After-Free
...
When viewport_->Stop() is called on line 169, it executes a synchronous call to the Windows Direct Manipulation COM interface (IDirectManipulationViewport). Because Direct Manipulation operates on a separate background thread, calling this from the Single-Threaded Apartment (STA) UI thread forces the COM runtime to wait. To prevent deadlocks and maintain UI responsiveness, COM enters a modal loop (e.g., via CoWaitForMultipleHandles) that synchronously pumps incoming window messages.
If a window destruction message (such as WM_NCDESTROY) is processed during this re-entrant loop, it triggers the destruction of the parent LegacyRenderWidgetHostHWND class via OnNCDestroy [[legacy_render_widget_host_win.cc, line 822]]. The deletion of the parent wrapper immediately destroys its std::unique_ptr<DirectManipulationHelper> direct_manipulation_helper_, deallocating this.
When the COM call Stop() finally returns, control resumes in the outer UpdateEventHandler frame. The code continues to execute on the freed this object, dereferencing viewport_ to call RemoveEventHandler [[line 170]] and performing writes to window_tree_host_ and event_target_ [[lines 173-174]]. Later, it makes virtual calls on viewport_ [[line 187]] and update_manager_ [[line 194]].
Potential Trigger Path
Note: The following steps are suggested/potential trigger conditions since our automated analysis tools do not have the capability to run code to generate a live proof-of-concept.
- An attacker initiates tab/window reparenting or rapid teardown (such as dragging a tab or triggering a sequence of window transitions).
- This causes
LegacyRenderWidgetHostHWND::UpdateParentto be invoked, which executes theUpdateEventHandleroptimization path under thefeatures::kUpdateDirectManipulationHelperOnParentChangeflag (enabled by default on Windows). - During
UpdateEventHandler,viewport_->Stop()is executed, entering a nested message loop. - While in this loop, a pending destruction message is dispatched, destroying the
LegacyRenderWidgetHostHWNDand deletingDirectManipulationHelper. - Control returns to
UpdateEventHandler, resuming execution on a freed heap allocation. An attacker who has groomed the heap can potentially replace the freed object to gain control of the COM interface pointers and hijack virtual calls, yielding Remote Code Execution (RCE) in the unsandboxed browser process.
Suggested Fix
To resolve this issue, we should use a base::WeakPtr of the helper to check for liveness after any call that can spin the message loop, or ensure that direct manipulation operations are safely aborted without blocking. Since DirectManipulationHelper implements base::WeakPtrFactory, we can query a weak pointer to this and abort execution if the object is destroyed during the COM wait:
void DirectManipulationHelper::UpdateEventHandler(
base::WeakPtr<aura::WindowTreeHost> window_tree_host,
ui::WindowEventTarget* event_target) {
...
base::WeakPtr<DirectManipulationHelper> weak_ptr = weak_factory_.GetWeakPtr();
if (event_handler_) {
event_handler_.Reset();
HRESULT hr = viewport_->Stop();
if (!weak_ptr) {
return;
}
hr = viewport_->RemoveEventHandler(view_port_handler_cookie_);
if (!weak_ptr) {
return;
}
}
...
Evaluated with Chrome root at commit: a2bea94528f4bd6cc57739c43fa3bb890b8367d3
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 does not check whether the DirectManipulationHelper object still exists after a synchronous COM call that can pump window messages and trigger its destruction.
Impact
An attacker who has groomed the heap could potentially replace the freed object to gain control of COM interface pointers and hijack virtual calls, yielding remote code execution in the unsandboxed browser process.
What the attacker needed
Windows platform; attacker can trigger window reparenting or teardown; heap grooming to control freed memory
The fix
The code should use a weak pointer to check that the helper still exists after any call that can spin the message loop, and abort if it has been destroyed.
How it was found
- An attacker initiates tab or window reparenting or rapid teardown.
- This invokes LegacyRenderWidgetHostHWND::UpdateParent and the UpdateEventHandler path.
- Inside UpdateEventHandler, viewport_->Stop() enters a nested message loop.
- A pending destruction message is dispatched, destroying the parent and deleting DirectManipulationHelper.
- Control returns to UpdateEventHandler and continues on freed memory.
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, a Windows system call briefly lets other window messages run, and one of those messages deletes the object that the code is still working with. The report suggests an attacker might be able to take over that freed memory and 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.