Use after free in Chromoting (CVE-2026-13787)
A use-after-free was reported in the Windows Chrome Remote Desktop host, where a cursor-monitor object is destroyed on the wrong thread while a 100Hz polling timer may still be running on a worker thread. The report claims an attacker could reallocate the freed memory and forge a vtable to hijack control flow, potentially gaining SYSTEM privileges, though this is based on code analysis only and was not verified.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 20 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 potential Use-After-Free vulnerability exists in the Chrome Remote Desktop Host on Windows (remoting_desktop.exe). An unsafe cross-thread destruction of MouseCursorMonitorWin::Delegate during session teardown creates a race condition with a high-frequency polling timer, potentially leading to arbitrary code execution as SYSTEM.
Affected files:
remoting/host/win/desktop_event_handler.ccremoting/host/win/mouse_cursor_monitor_win.cc
Estimated timestamp from git blame: 2025-11-18
Summary
A potential Use-After-Free (UAF) vulnerability exists in the Windows host component of Chrome Remote Desktop (remoting_desktop.exe). The issue occurs due to the improper destruction of the MouseCursorMonitorWin::Delegate object across different threads during session teardown. This leads to a race condition with a 100Hz polling timer, causing a worker thread to dereference a freed std::unique_ptr object.
Vulnerability Details
In MouseCursorMonitorWin, cursor capturing is handled by a nested Delegate class running on a dedicated worker thread managed by DesktopEventHandler.
- Timer Setup: In
Delegate::OnWorkerThreadStarted(), abase::RepeatingTimeris started on the worker thread at 100Hz to poll for cursor changes viaCaptureCursorImage(). The callback is bound usingbase::Unretained(this). TheDelegatealso creates and owns astd::unique_ptr<webrtc::MouseCursorMonitor> webrtc_monitor_. - Unsafe Teardown: When a remote session is disconnected,
MouseCursorMonitorWinis destroyed on the caller sequence (typically the Network thread). Its destructor triggersDesktopEventHandler::~DesktopEventHandler, which callsDesktopEventHandler::Core::Stop():
void DesktopEventHandler::Core::Stop() {
DCHECK_CALLED_ON_VALID_SEQUENCE(caller_sequence_checker_);
base::AutoLock lock(delegate_lock_);
delegate_.reset(); // Unsafe cross-thread destruction
if (worker_task_runner_) {
worker_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&Core::DestroyWorkerThread, this));
}
}
- The Race Condition: The call to
delegate_.reset()immediately destroys theDelegateobject on the caller sequence. This destroys thewebrtc_monitor_(freeing its heap memory) and thebase::RepeatingTimer. - Use-After-Free:
base::RepeatingTimeris sequence-affine. Destroying it on a sequence different from the one it was started on is unsafe and fails to safely cancel pending or currently executing tasks on the worker thread. Because the timer fires every 10ms, there is a high probability that the worker thread is simultaneously executingCaptureCursorImage(). The worker thread evaluateswebrtc_monitor_->Capture(), dereferencing the just-freedunique_ptrmemory, resulting in a Use-After-Free.
Impact
In Chrome Remote Desktop on Windows, remoting_desktop.exe typically runs with SYSTEM privileges. Because the freed memory belongs to a std::unique_ptr, it is not protected by MiraclePtr (BRP). Furthermore, the UAF occurs on a virtual method call (Capture()). This provides an ideal primitive for an attacker to hijack control flow by reallocating the memory and forging the vtable, potentially leading to local privilege escalation and arbitrary code execution as SYSTEM.
Potential Attacker Steps
(Note: These are suggested steps based on code analysis; our tooling cannot run live code to verify.)
- An attacker initiates an authenticated remote desktop connection to a Windows host.
- The connection is established, and the host spawns the
WinEventWorkerThreadand begins 100Hz cursor polling. - The attacker sprays the heap with forged vtable pointers (e.g., using RDP channels or other manipulable input streams).
- The attacker abruptly drops the WebRTC connection or sends a Jingle
session-terminatemessage. - The host caller sequence executes
delegate_.reset(), freeing the monitor. - If timed correctly, the worker thread simultaneously executes
CaptureCursorImage()and dereferences the attacker-controlled memory, hijacking control flow.
Suggested Fix
The Delegate and its members must be destroyed on the sequence where they are used. DesktopEventHandler::Core::Stop() should not call delegate_.reset() directly on the caller thread.
Instead, the destruction of the delegate should be posted to the worker thread as part of DestroyWorkerThread, or Stop() should be refactored to cleanly signal the worker thread to stop the timer and delete the delegate before the thread is joined or dropped.
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
Likely the delegate object and its timer are destroyed on the caller sequence rather than on the worker sequence that owns and uses them, so the timer's pending callback can still run against freed memory.
Impact
Because the host runs as SYSTEM and the freed object is a unique_ptr not covered by MiraclePtr, the race could allow local privilege escalation and arbitrary code execution as SYSTEM, though the report notes this was not verified with live code.
What the attacker needed
Authenticated remote desktop access; ability to drop the connection at will; heap spray of forged vtable pointers; precise timing of teardown
The fix
The delegate and its members should be destroyed on the worker sequence, for example by posting the destruction to the worker thread or having Stop() signal the worker to stop the timer and delete the delegate before the thread ends.
How it was found
- An attacker opens an authenticated remote desktop connection to a Windows host.
- The host starts the worker thread and begins 100Hz cursor polling.
- The attacker sprays the heap with forged vtable pointers.
- The attacker abruptly drops the connection or sends a session-terminate message.
- The caller sequence frees the monitor while the worker thread may still be capturing the cursor.
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 frees a piece of memory but another part of the program still tries to use it. Here, one thread throws away an object while a second thread is still checking it many times a second, so the second thread can read or call into memory that no longer belongs to it. If an attacker can put their own data in that freed spot, they might make the program run their code instead.
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.