Skip to content
Access control Write-up Advanced

DER Entitlements: The (Brief) Return of the Psychic Paper

Apple's libCoreEntitlements parsed DER-encoded entitlements with three different traversal routines that disagreed on how to handle sequence lengths, so an attacker could craft a binary whose entitlements looked different to the provisioning-profile subset check than to the kernel's entitlement query. This allowed a signed app to carry hidden entitlements, such as private kernel-related rights, that the subset check never saw.

Ivan Fratric Follow

Published on googleprojectzero.blogspot.com

Note: The vulnerability discussed here, CVE-2022-42855, was fixed in iOS 15.7.2 and macOS Monterey 12.6.2. While the vulnerability did not appear to be exploitable on iOS 16 and macOS Ventura, iOS 16.2 and macOS Ventura 13.1 nevertheless shipped hardening changes related to it.

Ivan Fratric (@ifsecure), on googleprojectzero.blogspot.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 the DER entitlement library implemented traversal in three places, and two of them ignored the sequence length and continued parsing after the value instead of after the sequence, so hidden child entitlements were visible to some checks but not others.

Impact

An attacker could get a signed app to hold entitlements the provisioning profile did not allow, potentially granting capabilities such as private kernel-related rights; the text notes the bug did not appear exploitable on iOS 16 and macOS Ventura, and hardening shipped in iOS 16.2 and macOS Ventura 13.1.

What the attacker needed

Ability to sign an app; a provisioning profile; target runs affected OS version

The fix

It was fixed in iOS 15.7.2 and macOS Monterey 12.6.2, with related hardening in iOS 16.2 and macOS Ventura 13.1.

How it was found

  1. Craft a DER entitlements blob in which extra entitlements are nested as children of a normal entitlement.
  2. Embed the crafted DER into a binary's signature blob by hooking the XML-to-DER conversion functions used by codesign.
  3. Sign the binary so the provisioning-profile subset check runs against the visible entitlements only.
  4. Run the binary so the kernel queries the hidden entitlement through the CEContextQuery API.

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.

Apple apps carry a list of permissions called entitlements, stored in a binary format called DER. The code that read this list had several separate readers that disagreed about where one permission ended and the next began, so a crafted app could hide extra permissions from the checker while the system still granted them.

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 from Apple

View all

The newest disclosed reports for this program.

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.