Use after free in Chromoting (CVE-2026-79194)
The Chromoting host on Windows stubs COM reference counting on a notification callback object, so the object can be freed while queued COM notifications still reference it. An attacker could potentially trigger a use-after-free and achieve remote code execution with SYSTEM privileges.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 3 months
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 (UAF) vulnerability exists in the Chromoting host on Windows due to incorrect COM lifetime management of the DefaultAudioDeviceChangeDetector object. The object stubs its reference counting and is destroyed while notifications may still be pending in the STA message queue, potentially leading to remote code execution in the highly privileged remoting process.
Affected files:
remoting/host/win/default_audio_device_change_detector.ccremoting/host/win/default_audio_device_change_detector.hremoting/host/audio_capturer_win.ccremoting/host/audio_capturer_win.h
Estimated timestamp from git blame: 2017-04-24
Summary
A potential Use-After-Free (UAF) vulnerability exists in the Chromoting (Remote Desktop) host process on Windows due to incorrect lifetime management of the DefaultAudioDeviceChangeDetector COM object. The class implements the IMMNotificationClient interface but stubs its COM AddRef() and Release() methods to return 1. This bypasses COM's reference-counting lifetime management, leaving the object's actual lifetime to be managed by a std::unique_ptr in AudioCapturerWin. This can lead to a UAF if OS notifications are queued in the thread's message loop after the object is destroyed.
Technical Details
The DefaultAudioDeviceChangeDetector class registers itself for notifications via IMMDeviceEnumerator::RegisterEndpointNotificationCallback. The Chromoting audio thread is initialized as a Single-Threaded Apartment (STA) via AutoThread::COM_INIT_STA. In an STA, COM callbacks from background threads (like the Windows Audio endpoint builder) are marshaled as messages to the thread's message queue.
The race condition occurs as follows:
- An audio device change event occurs. Windows frequently sends multiple notifications for a single event (e.g.,
OnDefaultDeviceChanged,OnDeviceStateChanged), which are marshaled and queued sequentially in the STA message loop. - The first notification is dispatched, calling
DefaultAudioDeviceChangeDetector::OnDefaultDeviceChanged, which sets an internalchanged_flag to true. - A subsequent task (
AudioCapturerWin::DoCapture), which runs as a timer-driven task in the same STA loop, detects this flag and callsResetAndInitialize(). ResetAndInitialize()callsDeinitialize(), which destroys theDefaultAudioDeviceChangeDetectorobject viadefault_device_detector_.reset(). The destructor callsUnregisterEndpointNotificationCallbackto stop future notifications.- However, if additional notification messages for the same object instance were already marshaled and present in the STA message queue, they remain in the queue. Because
AddRefandReleasewere stubbed out, the OS COM infrastructure did not increment a reference count to keep the C++ object alive. - When the STA message loop resumes and attempts to dispatch the remaining pending COM notification messages, it invokes a virtual method on the now-freed memory address of the detector instance, resulting in a Use-After-Free.
Impact
This is a potential high-severity vulnerability because the remoting_host.exe and remoting_desktop.exe processes are unsandboxed and typically run with SYSTEM privileges on Windows. Exploitation is feasible via vtable hijacking when the memory is reallocated during the subsequent Initialize() call (which performs multiple COM allocations that can reclaim the freed memory region). This could allow an attacker to achieve Remote Code Execution (RCE) with SYSTEM privileges.
Suggested Fix
The DefaultAudioDeviceChangeDetector should properly implement COM reference counting (e.g., by inheriting from Microsoft::WRL::RuntimeClass and using RuntimeClassFlags<ClassicCom>). The AudioCapturerWin should hold a Microsoft::WRL::ComPtr to the detector rather than a std::unique_ptr. This ensures that the object remains alive as long as the OS holds a reference to it in the message queue, even if AudioCapturerWin no longer needs it.
Evaluated with Chrome root at commit: a9e0d24757518a6f49f01bf5068f2cadfc6092f4
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 notification callback object stubs its COM AddRef and Release methods, so COM does not keep it alive while notifications are pending in the STA message queue.
Impact
This could allow an attacker to achieve remote code execution with SYSTEM privileges, though the report describes it as a potential issue and does not demonstrate exploitation.
What the attacker needed
Windows Chromoting host running; audio device change event occurs; attacker can influence timing
The fix
The detector should implement proper COM reference counting and be held through a COM smart pointer so it stays alive while notifications are queued.
How it was found
- An audio device change event causes Windows to queue multiple notifications in the STA message loop.
- The first notification is dispatched and sets the detector's changed flag.
- A timer-driven capture task sees the flag and calls ResetAndInitialize, which destroys the detector.
- Remaining queued notifications are dispatched against the freed object, causing a use-after-free.
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 program can ask Windows to tell it when the audio device changes. Windows sends those notifications as messages that wait in a queue. The program here deletes its notification handler too early, while messages for it are still waiting, so when Windows delivers them the program uses memory that has already been freed. That kind of mistake can let an attacker take control of the program.
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.