Use after free in Audio (CVE-2026-79210)
A use-after-free exists in the Android AAudio stream wrapper because a time-based mitigation frees a helper object immediately after closing the stream, leaving no margin for late callbacks. An attacker who can trigger a late callback could access freed memory and potentially achieve code execution in the browser process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 5 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 without the Chrome Security team.
Overview: A Use-After-Free (UAF) vulnerability exists in the AAudio implementation on Android 10 and 11 (API levels 29 and 30). The time-based mitigation for late audio callbacks is structurally flawed and frees a helper object immediately after closing the stream. An attacker can potentially trigger a late callback to access this freed memory, leading to arbitrary code execution in the browser process.
Affected files:
media/audio/android/aaudio_stream_wrapper.ccmedia/audio/android/aaudio_stream_wrapper.h
Estimated timestamp from git blame: 2024-01-22
Summary
A Use-After-Free (UAF) vulnerability exists in media/audio/android/aaudio_stream_wrapper.cc on Android API levels 29 and 30. The issue stems from a structurally flawed mitigation for a documented Android OS bug (crbug.com/1183255) where audio callbacks can continue to fire after AAudioStream_close() is called.
Because the mitigation's safety mechanism is purely time-based and fails to properly synchronize the lifetime of the AAudioDestructionHelper with the actual stream closure, a late callback can dereference a freed pointer, allowing an attacker to potentially achieve code execution in the browser process.
Technical Details
On Android versions prior to API 31, AAudioStreamWrapper uses an AAudioDestructionHelper to defer the closure and destruction of an AAudioStream.
- Flawed Mitigation: During
AAudioStreamWrapper::~AAudioStreamWrapper(), ownership of theAAudioDestructionHelperis passed to a delayed task scheduled for 1 second later. - Immediate Free After Close: When the delayed task executes 1 second later, the
~AAudioDestructionHelper()destructor is invoked. This destructor callsAAudioStream_close()and then immediately finishes. The memory backing the helper object is synchronously freed back to PartitionAlloc. - The Race Condition: The 1-second delay successfully separates the stream stop request from the
close()call, but it provides zero margin betweenclose()returning and the helper being freed. If an Android OS audio callback fires afterclose()returns (the exact scenario the code attempts to mitigate), it will access freed memory. - MiraclePtr Bypass: The
AAudioDestructionHelperpointer is registered with the OSlibaaudiolibrary as a barevoid* user_data. Consequently, MiraclePtr (BackupRefPtr) does not track this allocation, and a crash is not guaranteed upon dereference.
Potential Exploitation Steps
Note: These are potential steps based on code analysis; a full Proof-of-Concept has not been run.
- A compromised renderer repeatedly creates and closes low-latency audio streams while artificially saturating the device's CPU and audio subsystem to maximize callback latency.
- When an
AAudioStreamWrapperis closed, the 1-second delayed task is queued. - During that 1 second, the attacker performs a heap spray via IPCs to the browser process, aiming to reclaim the ~64-byte PartitionAlloc bucket that will hold the
AAudioDestructionHelperonce it is freed. - The delayed task executes, closing the stream and freeing the helper.
- The attacker reclaims the freed memory and writes a forged payload. Crucially, they zero out the memory representing the
base::Lock lock_. On Android,base::Lockwrapspthread_mutex_t, and the Bionic libc treats a zeroed structure as a valid, unlocked mutex. - A late
OnAudioDataRequestedCallbackexecutes, passing the dangling pointer toGetAndLockWrapper(). The lock succeeds, and the function returns an attacker-controlledwrapper_pointer. - The callback statically dispatches to
AAudioStreamWrapper::OnAudioDataRequested()using the fake wrapper. Inside, it callscallback_->OnAudioDataRequested(...). - Because
DataCallback::OnAudioDataRequestedis a virtual method, this results in a vtable hijack, redirecting execution to an attacker-controlled address. As this occurs in the browser process, it results in a full sandbox escape.
Suggested Fix
The 1-second delay mitigation is insufficient. To fix this:
- The
AAudioStream_close()call should occur before the 1-second delay, so the delay actually pads the time after closure while keeping the helper alive. - Alternatively, use a more robust synchronization primitive, such as a thread-safe reference count (
base::RefCountedThreadSafe) for the helper object, ensuring it is only destroyed once all callbacks have verifiably ceased.
Evaluated with Chrome root at commit: 096fc8fdbfacf2546485756d03f160a3d04fcc9b
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. 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 mitigation's safety mechanism is purely time-based and fails to properly synchronize the lifetime of the helper object with the actual stream closure, so a late callback can dereference a freed pointer.
Impact
An attacker could potentially achieve arbitrary code execution in the browser process, resulting in a full sandbox escape, though a full proof-of-concept has not been run.
What the attacker needed
Android 10 or 11 (API 29 or 30); compromised renderer; ability to saturate CPU and audio; heap spray via IPCs
The fix
The AAudioStream_close() call should occur before the 1-second delay, or a thread-safe reference count should be used for the helper object to ensure it is only destroyed once all callbacks have verifiably ceased.
How it was found
- A compromised renderer repeatedly creates and closes low-latency audio streams while saturating CPU and audio to maximise callback latency.
- When an AAudioStreamWrapper is closed, a 1-second delayed task is queued.
- During that second, the attacker heap-sprays via IPCs to reclaim the ~64-byte PartitionAlloc bucket that will hold the helper.
- The delayed task executes, closing the stream and freeing the helper.
- The attacker reclaims the freed memory and writes a forged payload, zeroing the lock structure.
- A late OnAudioDataRequestedCallback executes, passing the dangling pointer to GetAndLockWrapper(), which returns an attacker-controlled wrapper pointer and leads to a vtable hijack.
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 still keeps a pointer to it, and later uses that pointer as if the memory were still valid. Here, a helper object is freed right after an audio stream is closed, but the phone's audio system might still call back into that object, letting an attacker who can control the freed memory take over 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.