
IOS audio buffer overflow CVE-2025-31200 POC
CVE-2025-31200 is a buffer overflow vulnerability in Apple's CoreAudio framework affecting the Apple Positional Audio Codec (APAC) decoder. The bug exists in the APACChannelRemapper::Process function within APACHOADecoder::DecodeAPACFrame.
Affected Systems:
The vulnerability stems from a logic error in channel layout validation:
mRemappingArray is sized based on the lower 2 bytes of mChannelLayoutTag from the global channel layoutThe exploit works by crafting a malicious APAC audio file with:
This repository contains a Python implementation that generates the malicious APAC cookie exploiting this vulnerability.
poc.py - Main exploit generatorgenerate_audio_simple.py - Audio file generationcaf_utils.py - APAC cookie manipulation utilitiesparser.py - Cookie parsing and exploit payload creationtest_exploit.py - Exploit verification and analysiscreate_malicious_mp4.py - MP4 payload generation# Generate malicious APAC cookie
pip install numpy construct
python3 poc.py
# Verify exploit payload
python3 test_exploit.py
# Create malicious MP4 (requires macOS afconvert)
python3 create_malicious_mp4.py
The scripts generate:
exploit_cookie.dat - Malicious APAC cookie with channel count mismatchmalicious_apac.m4a - Weaponized MP4 file ready for testingpoc.py)test_exploit.py)create_malicious_mp4.py)APACChannelRemapper::ProcessTo verify the exploit on vulnerable systems:
APACChannelRemapper::Process with EXC_BAD_ACCESSWith careful payload crafting, this vulnerability could potentially be leveraged for:
Code Execution: By controlling the out-of-bounds write operations, an attacker might:
Sandbox Escape: Since CoreAudio runs in various security contexts:
Remote Attack Scenarios:
Apple addressed this vulnerability in:
The fix validates channel counts between global and remapping layouts before processing, preventing the mismatch that causes the buffer overflow.

This proof of concept is provided for educational and research purposes only. It demonstrates a critical security vulnerability in Apple's CoreAudio framework to help security researchers understand the attack mechanics and improve defensive measures.