Skip to content
Access control Write-up Advanced

Rotten Apples: macOS Codesigning Translocation Vulnerability

The researcher found that by replacing the code signature LoadCommand of a binary with one from another binary, the system would sometimes execute it with restricted entitlements, allowing access to task ports and potential privilege escalation. The exploit was unreliable and later stopped working after an apparent Apple patch.

Brandon Duncan Follow

Published on osec.com

It’s a breezy autumn night and I’m doing some research on my Mac while lazily flipping through volume one of “OS Internals” by Johnathan Levin, specifically the chapter on the Mach-O file format. All of a sudden, a thought buds in my mind: “What if I can translocate one code signature blob from another, entitlements…

Brandon Duncan, on osec.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a memory management bug in taskgated where an authorization pointer is freed without being returned, causing undefined behaviour that grants entitlements.

Impact

An attacker could potentially achieve local privilege escalation, bypass security components like tccd and amfid, and possibly gain kernel task port access, though the exploit is unreliable and limited by time and system checks.

What the attacker needed

Local access to a macOS system; ability to run unsigned binaries; thin Mach-O binary with valid signature

The fix

Apple issued a stealth patch that changed the code signature format, but it did not fully mitigate the vulnerability and may have reduced security posture.

How it was found

  1. Create a thin Mach-O binary with a valid code signature and the desired entitlement.
  2. Use a tool to replace the LC_CODE_SIGNATURE LoadCommand with one from another binary that has restricted entitlements.
  3. Execute the modified binary; within a grace period of about 40 minutes, it may run with those entitlements.
  4. If successful, the binary gains access to task ports, allowing memory read/write and code injection into system processes.

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 write-up has not been written yet. The Original tab links to the source.

Code signing is like a seal that proves software comes from a trusted source and hasn't been tampered with. The researcher discovered a way to copy the seal from one program to another, tricking the system into giving the modified program special permissions it shouldn't have. This could let an attacker take control of important system processes.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Brandon Duncan

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.