ipadecrypt icon indicating copy to clipboard operation
ipadecrypt copied to clipboard

Bug: universal/fat decrypt can still output cryptid != 0 after success

Open b1atant opened this issue 7 months ago • 3 comments

What happens

Decrypt can report success, but final verify still fails with cryptid != 0 for universal/fat binaries.

Reproduction

  • Some of the apps that fail to decrypt:
    • https://apps.apple.com/us/app/zombiebooth-2-zombie-selfie/id689913130
    • https://apps.apple.com/us/app/chubby-booth-plump-you-face/id958811911
    • https://apps.apple.com/us/app/hair-styles-haircuts-color-makeover-salon-booth/id1069785796
    • https://apps.apple.com/us/app/video-compressor-size-reduce/id1076279145
    • https://apps.apple.com/us/app/weaphones-firearms-sim-mini/id539694058
    • https://apps.apple.com/us/app/falldown-the-falling-ball-game/id462132333

Likely cause

For fat binaries:

  • metadata (cryptoff / cryptsize / cryptid) can be taken from one slice while runtime bytes come from another slice
  • encrypted sibling slices can remain in output and trigger final verify failure

Expected fix

  • Match the on-disk slice to the runtime-loaded slice using:
    • cputype
    • cpusubtype (capability bits masked)
    • 32/64-bit header class
  • Support both fat32 and fat64
  • Apply consistently across:
    • main executable path
    • dyld-loaded framework path
    • rescue/mmap path
  • Ensure final kept output slices are not encrypted:
    • thin to matched runtime slice, or
    • clear/decrypt cryptid for all kept slices

Important edge case

Even when the runtime-loaded slice is already clear (cryptid=0), final output must not retain encrypted sibling slices in the same fat binary (e.g., armv7 cryptid=1), or final verify still fails.

Reference patch

  • helper/helper.c https://gist.github.com/b1atant/5b27c7fddc51d738ee32863c6505bf7d

  • helper.c

Disclosure

  • AI was used to generate the reference C patch and I validated behavior/results.
  • I do not write or understand C, so I am filing an issue instead of a PR.
  • I am documenting the bug and the full reproduction steps, and leaving the final implementation to developers who understand C better.

b1atant avatar Apr 25 '26 21:04 b1atant

What is the iOS and jailbreak?

londek avatar Apr 25 '26 21:04 londek

iPhone 11 running iOS 16.1.1 and Dopamine rootless

b1atant avatar Apr 25 '26 22:04 b1atant

Addressed in 0.5.3

londek avatar Apr 25 '26 23:04 londek