Skip to content
RCE Write-up Advanced

FORCEDENTRY: Sandbox Escape

The FORCEDENTRY iMessage exploit's second stage escaped the IMTranscoderAgent sandbox using only logic bugs, by deserialising crafted Objective-C objects that caused an attacker-supplied NSPredicate to be evaluated inside CommCenter. This gave the attackers arbitrary code execution in that process, letting them fetch and run a next-stage payload from their server.

googleprojectzero.blogspot.com

Published on googleprojectzero.blogspot.com

We want to thank Citizen Lab for sharing a sample of the FORCEDENTRY exploit with us, and Apple’s Security Engineering and Architecture (SEAR) group for collaborating with us on the technical analysis. Any editorial opinions reflected below are solely Project Zero’s and do not necessarily reflect those of the…

The author, 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 a chain of design weaknesses: NSXPC protocols typed arguments as NSObject so any subclass (including NSPredicate) could cross the process boundary, and PrototypeTools' PTRow deserialisation called allowEvaluation on an attacker-supplied predicate and then evaluated it without validating its contents.

Impact

The attackers could escape the IMTranscoderAgent sandbox, request a next-stage payload from their command and control server and execute it, all without memory corruption or dependence on a particular OS version.

What the attacker needed

Victim receives a crafted iMessage; first-stage JBIG2 exploit succeeds; target runs a vulnerable iOS version

The fix

iOS 15.1 restricted NSExpression operations with significant side effects and deprecated casting string class names to Class, and PrototypeTools was hardened to only decode predicates when internal security policies allow it.

How it was found

  1. Send a .gif iMessage attachment that is really a PDF, triggering the JBIG2 heap overflow and the logic-gate machine.
  2. Use the machine to deserialise and evaluate an NSFunctionExpression that deletes the delivered file and builds a payload.
  3. Pass an array containing an AVSpeechSynthesisVoice and a PTSection with a PTRow over the com.apple.commcenter.xpc NSXPC service.
  4. Deserialising the voice loads AXSpeechImplementation.bundle, whose dependency chain pulls in PrototypeTools so PTSection and PTRow can be decoded.
  5. PTRow's decoder calls allowEvaluation on the attached NSPredicate, and PTSection's reload logic evaluates it against the settings.
  6. The evaluated predicate fetches, decrypts and decompresses a next-stage plist, then parses and evaluates its 'a' key as an NSExpression.

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 devices run apps inside 'sandboxes', which are restricted boxes that limit what each app can touch. This write-up shows how attackers broke out of one such box without corrupting memory, by abusing legitimate features: a serialised object was passed between processes and a stored 'predicate' (a small query language used for filtering) was quietly evaluated, running the attacker's instructions. The lesson is that features which evaluate code-like strings are dangerous when they accept data from another process.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.