Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2025-31200 PoC — Apple iOS和Apple iPadOS 安全漏洞

Source
Associated Vulnerability
Title:Apple iOS和Apple iPadOS 安全漏洞 (CVE-2025-31200)
Description:A memory corruption issue was addressed with improved bounds checking. This issue is fixed in iOS 18.4.1 and iPadOS 18.4.1, macOS Sequoia 15.4.1, tvOS 18.4.1, visionOS 2.4.1, watchOS 11.5. Processing an audio stream in a maliciously crafted media file may result in code execution. Apple is aware of a report that this issue may have been exploited in an extremely sophisticated attack against specific targeted individuals on versions of iOS released before iOS 18.4.1.
Description
IOS audio buffer overflow CVE-2025-31200 POC
Readme
# CVE-2025-31200: CoreAudio APAC Channel Remapping Buffer Overflow

## Vulnerability Overview

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:**
- iOS < 18.4.1
- macOS < 15.4.1
- All Apple devices with CoreAudio framework

## Technical Details

### Root Cause
The vulnerability stems from a logic error in channel layout validation:

1. The `mRemappingArray` is sized based on the lower 2 bytes of `mChannelLayoutTag` from the global channel layout
2. During audio frame processing, the decoder uses a separate remapping channel layout count to iterate through this array
3. By creating a mismatch between these two channel counts, an attacker can cause out-of-bounds memory access

### Attack Vector
The exploit works by crafting a malicious APAC audio file with:
- Global channel layout: 4 channels (controls array allocation size)
- Remapping channel layout: 64 channels (controls iteration count)
- Result: 16x out-of-bounds memory access during channel remapping

## Proof of Concept

This repository contains a Python implementation that generates the malicious APAC cookie exploiting this vulnerability.

### Files
- `poc.py` - Main exploit generator
- `generate_audio_simple.py` - Audio file generation
- `caf_utils.py` - APAC cookie manipulation utilities
- `parser.py` - Cookie parsing and exploit payload creation
- `test_exploit.py` - Exploit verification and analysis
- `create_malicious_mp4.py` - MP4 payload generation

### Usage
```bash
# 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:
- Benign test audio files (WAV, M4A, CAF)
- `exploit_cookie.dat` - Malicious APAC cookie with channel count mismatch
- `malicious_apac.m4a` - Weaponized MP4 file ready for testing

### Exploitation Process
1. Create channel layout mismatch in APAC cookie (`poc.py`)
2. Verify payload integrity (`test_exploit.py`)
3. Embed cookie in MP4/M4A audio container (`create_malicious_mp4.py`)
4. Deploy malicious file to vulnerable system
5. Trigger processing via audio playback (AVAudioPlayer, web browser, etc.)
6. Out-of-bounds access occurs in `APACChannelRemapper::Process`

### Testing Environment
To verify the exploit on vulnerable systems:
- **Target**: macOS < 15.4.1 or iOS < 18.4.1
- **Tools**: Xcode with Guard Malloc enabled
- **Expected crash**: `APACChannelRemapper::Process` with EXC_BAD_ACCESS
- **Debugging**: Use LLDB to examine memory corruption patterns

## Impact and Exploitation Potential

### Immediate Effects
- **Denial of Service**: Guaranteed crash when malicious audio is processed
- **Memory Corruption**: Out-of-bounds read/write operations
- **Application Termination**: Any app processing the malicious audio will crash

### Advanced Exploitation
With careful payload crafting, this vulnerability could potentially be leveraged for:

**Code Execution**: By controlling the out-of-bounds write operations, an attacker might:
- Overwrite function pointers or virtual table entries
- Corrupt heap metadata to achieve arbitrary write primitives
- Chain with other vulnerabilities for full system compromise

**Sandbox Escape**: Since CoreAudio runs in various security contexts:
- Browser exploitation via HTML5 audio elements
- Email client exploitation via audio attachments  
- System service exploitation in mediaserverd

**Remote Attack Scenarios**:
- Web-based attacks through malicious audio content
- Messaging app exploitation via audio message attachments
- Email-based attacks with malicious audio files
- Drive-by downloads of malicious media content

### Attack Vectors
- **Web browsers** processing HTML5 audio/video with APAC encoding
- **Media players** and streaming applications
- **Messaging applications** handling audio attachments
- **Email clients** processing multimedia content
- **System media services** automatically processing audio files

## Mitigation

Apple addressed this vulnerability in:
- iOS 18.4.1 (April 2025)
- macOS 15.4.1 (April 2025)

The fix validates channel counts between global and remapping layouts before processing, preventing the mismatch that causes the buffer overflow.

![Alt text](pewpew/pewpew.jpg)

## Disclaimer

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.
File Snapshot

[4.0K] /data/pocs/458fb42973ec8435b64a9d213221f2fbd655cdbf ├── [1.1K] caf_utils.py ├── [ 922] create_malicious_mp4.py ├── [3.4K] generate_audio.py ├── [1.4K] parser.py ├── [4.0K] pewpew │   └── [ 63K] pewpew.jpg ├── [1.2K] poc.py ├── [4.6K] README.md └── [4.1K] test_exploit.py 1 directory, 8 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →