# iMessage Attack Chain Flow

Zero-click remote exploit chain on iOS 18.x delivered via a malformed AMR audio file in iMessage.

---

## Chain

1. CVE-2025-31200 — CoreAudio AMR 12.2 decoder heap corruption (AudioConverterService).
2. CVE-2025-31201 — Kernel R/W via AMPDU subframe length confusion in AppleBCMWLAN (`parseAggregateFrame`); PAC bypass by referent replacement.
3. BCM4387 coexistence SRAM — kernel-mode write to SRAM at `0x102000` (below IOMMU boundary `0x1173FF`); HCI command injection into the BT controller. No CVE. Unpatched on iPhone 13–16.

---

## Delivery

- File: AMR voice note, 1,606 bytes, SHA256 `0de03d7fe9dc023d5e4824322195dcc2359ec15acd714ade01f50488214c2d60`.
- 50 × FT=7 frames; valid container; payload carried in codec bitstream parameters.
- Processed by iMessage while locked; no user interaction.

---

## Stage 1 — CoreAudio (CVE-2025-31200)

- AMR 12.2 decoder reads pitch lag without 3GPP TS 26.090 range checks.
- Observed: 189 parameter violations across 50 frames; pitch lag max 248 (legal max 143); LSF ordering violated in 50/50 frames.
- Decoder allocates 306 bytes, writes 516 — 210-byte heap overflow into `imagent`.

```
AudioConverterService ACMP4AACBaseDecoder.cpp: Input format: 2 ch, 44100 Hz, aac
AudioConverterService ACMP4AACBaseDecoder.cpp: inMagicCookie=0x0, inMagicCookieByteSize=39
```

Collateral: PME enforcement failures, AP ↔ co-processor connection blocks, HLS variant-switch loops, GPU/DCP errors, occasional SoC stalls.

```
audiomxd      Connection between ports Application Processor and <CO-PROC> not allowed — PME not enabled
kernel        AppleDCPDPTXController::getLinkDataGated getALPMEnabled failed
mediaplaybackd FigAlternate/HLS variant switching loop detected → stall
launchd       ReportMemoryException → SoC stall
```

---

## Stage 1a — Attachment materialization

```
IMTransferAgent  Succeeded decrypting input URL: file:///var/mobile/tmp/com.apple.messages/<GUID>/<FILE>.m4a
```

---

## VM stage

Payload contains an embedded VM: 4-byte fixed instructions, 8 registers, 175 unique opcodes, opcode entropy 7.10 bits/byte. LLVM IR cosine similarity 0.9492. Final state `V0 = 0x300016` — stages `IOConnectCallMethod` selector `0x16` against `AppleBCMWLAN`.

---

## Stage 2 — Kernel escalation (CVE-2025-31201)

- `IOConnectCallMethod(0x16)` → `parseAggregateFrame` in `AppleBCMWLAN.dext`.
- AMPDU subframe length 65,535 written into 2,048-byte slot — 63,487-byte OOB write.
- PAC bypass: existing authenticated IOKit port pointer kept; referent replaced. Verification passes.

Device: iPhone16,2 · chip=4388c0 · iOS 18.3 build 22D5034e · PCIe/Poppy.

```
IO80211ControllerMonitor  setAMPDUstat unhandled kAMPDUStat_ type 14
IO80211ControllerMonitor  setAMPDUstat unhandled kAMPDUStat_ type 13
bug_type: 221  chip=4388c0
WiFi State: On (2.4 GHz)
Firmware: BCM4388C0_22.2.507.1323_PCIE_Poppy_CLPC_OS_STATS_20241003.bin
```

`bug_type: 221` indicates a WiFi firmware panic in the wireless SoC.

---

## Stage 2a — AWDL peer state

```
IDSDaemon               Noting peer token {shouldNoteToken: YES, token: <REDACTED>, service: com.apple.madrid}
PeerLookup_DBCache      DB Cache Hit { service: com.apple.madrid }
PeerLookup_SwiftData    -> Good to go, we have it
```

---

## Stage 3 — BCM4387 hardware pivot (no CVE, unpatched)

- BCM4387 MMIO base resolved from AppleBCMWLAN driver mapping.
- Coexistence SRAM at `0x102000` sits below IOMMU boundary `0x1173FF`.
- `HCI_BLE_Set_Coexistence_Parameters` (OCF `0x3C`) injected at payload offset 865.
- BT identity spoof triggers Auto-Unlock evaluation; SEP signs without user prompt.

---

## Stage 4 — CryptoTokenKit signing

```
identityservicesd  Decrypting message <GUID> of encryption type "pair-tetra"
identityservicesd  Query for encryption with IDs of remote/local devices
CryptoTokenKit     operation:2 algo:algid:sign:ECDSA:digest-X962:SHA256
CryptoTokenKit     <sepk:p256(d) kid=<KID>> parsed for identityservicesd
```

No key material exported. Signing authority used in place.

---

## Affected Versions

| Component | Affected | Patched | Status |
|---|---|---|---|
| CVE-2025-31200 CoreAudio | iOS 18.4 and below | iOS 18.4.1 | Patched |
| CVE-2025-31201 AppleBCMWLAN | iOS 18.4 and below | iOS 18.4.1 | Patched |
| BCM4387 coexistence SRAM | iPhone 13–16 | None | Unpatched |

---

## CVE Summary

| CVE | Component | Description | CVSS | Status |
|---|---|---|---|---|
| CVE-2025-31200 | CoreAudio / AudioConverterService | Heap corruption via illegal AMR bitstream parameters | 9.8 | Patched iOS 18.4.1 |
| CVE-2025-31201 | AppleBCMWLAN.dext | Kernel escalation via AMPDU length confusion + PAC bypass | 9.8 | Patched iOS 18.4.1 |
| BCM4387 coex | Broadcom BCM4387 | Coexistence SRAM below IOMMU — HCI injection | High | No CVE, no patch |
| (No CVE) | CryptoTokenKit / SEP | SEP-backed signing from compromised context | High | Remediation recommended |
| (No CVE) | PME / audiomxd / powerd | PME enforcement failure → SoC stalls | High | Firmware review recommended |

---

## Recommendations

1. Validate codec bitstream parameters (AMR pitch lag, LSF, codebook indices) against 3GPP TS 26.090.
2. Validate AMPDU subframe length against allocated buffer size in AppleBCMWLAN.
3. Extend IOMMU coverage to BCM4387 coexistence SRAM (`0x102000`–`0x1173FF`).
4. Require attestation of caller before CryptoTokenKit / SEP-backed signing operations.
5. Extend BlastDoor inspection beyond container framing into codec bitstream parameters.

---

## Status

| Item | Detail |
|---|---|
| Reported to Apple | Dec 20, 2024 |
| Re-reported to Apple & US-CERT | Jan 21, 2025 (VRF#25-01-MPVDT) |
| Patched (CVE-2025-31200, CVE-2025-31201) | Apr 16, 2025 — iOS 18.4.1 |
| CISA KEV listing | Apr 16, 2025 |
| BCM4387 submitted to Broadcom PSIRT | Mar 2026 — no CVE, no patch |
