Use after free in Audio (CVE-2026-8002)
A use-after-free exists in the macOS audio capture code because a failed AudioDeviceStop call does not synchronise with CoreAudio callbacks, allowing the freed object to be accessed. An attacker could spray the heap and hijack a virtual call to achieve remote code execution in the audio service process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 43 days
Project Fortify, an experimental security project, has identified the following potential security issue.
Overview: A potential Use-After-Free (UAF) vulnerability exists in the macOS Catap audio implementation due to improper synchronization during object destruction. If AudioDeviceStop fails during a device change, CoreAudio callbacks can still execute and access the freed CatapAudioInputStreamSource object. This could allow an attacker to achieve Remote Code Execution (RCE) within the audio service utility process.
Affected files:
media/audio/mac/catap_audio_input_stream.mmmedia/audio/mac/catap_audio_input_stream.h
Estimated timestamp from git blame: 2025-10-15
Description
A potential Use-After-Free (UAF) vulnerability has been identified in the macOS CatapAudioInputStreamSource implementation within the Chrome audio service (introduced for macOS 14.2+ system audio capture). The vulnerability stems from an incorrect assumption regarding the synchronous guarantees of CoreAudio's AudioDeviceStop API when it encounters an error state, combined with a lack of thread synchronization.
CatapAudioInputStreamSource registers its raw this pointer with the CoreAudio HAL via AudioDeviceCreateIOProcID. The DeviceIoProc callback runs on a high-priority CoreAudio real-time thread and periodically calls OnCatapSample(this).
During a default audio device change, CatapAudioInputStream::OnDefaultDeviceChange() triggers RestartStream(), which synchronously calls source_->Stop() and then immediately destroys the object via source_.reset().
Inside CatapAudioInputStreamSource::Stop(), the code relies entirely on AudioDeviceStop to fence the IO thread:
// Reversing Step 4.
// The call to AudioDeviceStop is synchronous. It will not return until any
// current callbacks have finished executing.
OSStatus status =
catap_api_->AudioDeviceStop(aggregate_device_id_, tap_io_proc_id_);
if (status != noErr) {
ReportStopStatus(false, timer.Elapsed());
SendLogMessage("%s => Error stopping the device. Status: %d", __func__,
status);
}
If the user disconnects the active audio device, AudioDeviceStop can fail (e.g., returning kAudioHardwareBadDeviceError). When it fails, it does not act as a synchronous fence. The implementation merely logs the error and proceeds. The subsequent Close() call in the destructor also attempts AudioDeviceDestroyIOProcID(), which will likewise fail if the IOProc is actively running or the device handle is bad.
Because the implementation lacks a fallback synchronization primitive (such as a base::Lock to synchronize the destruction path and the IOProc callback—a pattern explicitly used to prevent this exact issue in older macOS audio components like AUHALStream), the OS can invoke the DeviceIoProc callback concurrently with or after the object's destruction.
Impact
Because the client_data pointer passed to CoreAudio crosses the FFI (Foreign Function Interface) boundary as a C-style raw pointer, it is not protected by Chrome's BackupRefPtr (MiraclePtr) quarantine mechanism. The freed memory is immediately available for reallocation.
When the CoreAudio thread executes DeviceIoProc with the stale pointer, it invokes OnCatapSample(), which interacts with several member variables and eventually performs a virtual method call:
sink_->OnData(audio_bus_.get(), capture_time, kMaxVolume,
glitch_helper_.ConsumeGlitchInfo());
If an attacker sprays the heap in the audio service process, they can control the freed memory, forge the sink_ pointer, and hijack the vtable to achieve arbitrary code execution (RCE) within the sandboxed audio service utility process.
Suggested Reproduction Steps
Note: As an LLM agent, I do not have the ability to run code or provide a working proof-of-concept exploit. The following are suggested steps an attacker would potentially follow to trigger this vulnerability.
- An attacker hosts a malicious website and uses standard Web APIs (e.g.,
navigator.mediaDevices.getDisplayMedia({audio: true})) to request system audio capture. - Concurrently, the attacker's script utilizes Web Audio or other IPC primitives to spray the heap in the audio service process, preparing malicious object structures.
- The user changes the default audio device (e.g., plugs in or unplugs headphones, or the attacker waits for a Bluetooth audio device to naturally disconnect).
- This event invokes
CatapAudioInputStream::OnDefaultDeviceChange() -> RestartStream(), which callsStop()followed by the immediate destruction of theCatapAudioInputStreamSourceinstance. - Due to the device transition,
AudioDeviceStopfails, failing to fence the CoreAudio real-time thread. - The CoreAudio IOProc callback executes, casting the freed
client_datapointer and accessing the attacker-controlled sprayed memory. - The code reaches
sink_->OnData(...), dereferencing the attacker's forged vtable and executing arbitrary code.
Evaluated with Chrome root at commit: False
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. Please feel free to reach out to me if you have concerns or feedback.
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 assumes AudioDeviceStop always synchronously fences the IO thread, but when it fails it does not, and there is no fallback lock to synchronise destruction with the callback.
Impact
An attacker could achieve remote code execution within the sandboxed audio service utility process, though the report notes this is a potential issue and no working exploit is provided.
What the attacker needed
MacOS 14.2+ system audio capture; victim visits malicious website; user changes default audio device; attacker can spray heap in audio service
The fix
The code should add a fallback synchronisation primitive, such as a lock, to synchronise the destruction path with the IOProc callback, as done in older macOS audio components.
How it was found
- Attacker hosts a malicious website and requests system audio capture using standard Web APIs.
- Attacker's script sprays the heap in the audio service process to prepare malicious object structures.
- The user changes the default audio device, for example by plugging in or unplugging headphones.
- This triggers OnDefaultDeviceChange and RestartStream, which calls Stop and then destroys the CatapAudioInputStreamSource instance.
- Because of the device transition, AudioDeviceStop fails and does not fence the CoreAudio real-time thread.
- The CoreAudio IOProc callback executes with the freed pointer, accesses sprayed memory, and reaches a virtual call that can be hijacked.
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 memory but still uses it later. Here, the audio code frees an object after trying to stop a device, but if that stop fails, the system can still call back into the freed object. An attacker who can control what replaces that memory could then 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.