Use after free in Audio (CVE-2026-17784)
A use-after-free exists in AUAudioInputStream on macOS because teardown is not synchronised with real-time CoreAudio callbacks. A compromised renderer with microphone permissions could trigger the race to achieve memory corruption in the sandboxed Audio Service process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
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) exists in AUAudioInputStream on macOS because it does not synchronize teardown with real-time CoreAudio callbacks. Unlike its output counterpart, AUHALStream, this class fails to clear its callback context or use locks to protect member state during shutdown. A compromised renderer can potentially trigger this race to achieve memory corruption in the sandboxed Audio Service process.
Affected files:
media/audio/apple/audio_low_latency_input.ccmedia/audio/apple/audio_low_latency_input.hmedia/audio/audio_manager_base.cc
Estimated timestamp from git blame: 2018-05-24
Summary
A potential Use-After-Free (UAF) vulnerability has been identified in AUAudioInputStream on macOS. The issue arises from a lack of synchronization between the Audio Manager thread (which handles object lifetime) and the real-time CoreAudio thread (which handles audio data callbacks). This allows a system callback to dereference a stale this pointer after the object has been deleted.
Root Cause Analysis
In media/audio/apple/audio_low_latency_input.cc, AUAudioInputStream registers a static callback DataIsAvailable with the CoreAudio framework, passing a raw this pointer as the context (inputProcRefCon).
There are two primary concerns with the current implementation:
- Lack of Synchronization: There is no mutex or lock protecting access to member variables (like
sink_andfifo_) within the real-time callback. - Late-Arriving Callbacks: It is a known behavior of the macOS CoreAudio
HALOutputunit that callbacks can be invoked even afterAudioOutputUnitStop()has been called. The relatedAUHALStreamclass (for audio output) explicitly documents this risk and implements abase::Lockand callback-clearing logic to mitigate it.AUAudioInputStreamlacks these defenses.
When Close() is called, the AUAudioInputStream object is deleted. If a late CoreAudio callback arrives after this deletion, it dereferences the stale this pointer, leading to a UAF.
Potential Attack Vector
A compromised renderer with microphone permissions can access this path through the blink.mojom.RendererAudioInputStreamFactory interface. By repeatedly triggering AEC reinitialization (via AssociateInputAndOutputForAec) or rapidly opening and closing streams, an attacker can widen the race window and potentially achieve a UAF write primitive.
Impact
This is a potential heap Use-After-Free write. Because the context is a raw pointer passed to a system API, Chromium's MiraclePtr mitigation does not provide protection. Successful exploitation could lead to arbitrary code execution within the sandboxed macOS Audio Service process.
Suggested Steps to Trigger (Potential)
- From a compromised renderer, request an audio input stream with the
ECHO_CANCELLEReffect enabled. - Start recording to activate the CoreAudio real-time thread callbacks.
- In a loop, invoke
AssociateInputAndOutputForAecwith alternating output device IDs to force frequent reinitialization of the voice processing unit. - Simultaneously initiate stream closure while trying to reclaim the freed
AUAudioInputStreammemory via other allocations in the Audio Service. - Observe if the late callback triggers a crash or memory corruption when accessing the
sink_member.
Recommended Fix
Apply the synchronization pattern used in AUHALStream:
- Add a
base::LocktoAUAudioInputStreamand acquire it withinOnDataIsAvailableand teardown methods. - In
Stop()andClose(), explicitly clear the CoreAudio input callback by setting thekAudioOutputUnitProperty_SetInputCallbackproperty to NULL before disposing of the Audio Unit.
Evaluated with Chrome root at commit: 1a8d40fc44df2088d5945c0bf53584038aa1614a
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 AUAudioInputStream class passes a raw this pointer to CoreAudio callbacks without a lock or callback-clearing on teardown, unlike AUHALStream.
Impact
This is a potential heap use-after-free write that could lead to arbitrary code execution within the sandboxed macOS Audio Service process; MiraclePtr does not protect because the context is a raw pointer.
What the attacker needed
Compromised renderer; microphone permissions
The fix
The fix should add a lock to AUAudioInputStream and clear the CoreAudio input callback before disposing of the Audio Unit, following the pattern used in AUHALStream.
How it was found
- From a compromised renderer, request an audio input stream with the ECHO_CANCELLER effect enabled.
- Start recording to activate the CoreAudio real-time thread callbacks.
- In a loop, invoke AssociateInputAndOutputForAec with alternating output device IDs to force frequent reinitialization of the voice processing unit.
- Simultaneously initiate stream closure while trying to reclaim the freed AUAudioInputStream memory via other allocations in the Audio Service.
- Observe if the late callback triggers a crash or memory corruption when accessing the sink_ member.
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, like deleting a file and then trying to open it. Here, an audio input object is deleted while the system's audio callback might still try to use it, which can corrupt memory. An attacker who already controls a web page's renderer could try to win this race and run code inside the audio service.
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.