Hacktricks-skills ios-entitlements-extractor
Extract entitlements and mobile provision files from iOS app binaries (IPA files, compiled apps, or jailbroken device binaries). Use this skill whenever the user needs to analyze iOS app permissions, review embedded entitlements, extract plist data from compiled binaries, or perform iOS security testing. Trigger for any request involving iOS app binary analysis, entitlement extraction, mobile provision file recovery, or MASVS-PLATFORM security testing.
git clone https://github.com/abelrguezr/hacktricks-skills
skills/mobile-pentesting/ios-pentesting/extracting-entitlements-from-compiled-application/SKILL.MDiOS Entitlements Extractor
Extract entitlements and mobile provision files from compiled iOS application binaries, even when direct file access isn't available.
When to Use This Skill
Use this skill when:
- You need to extract
files from an iOS app binary.entitlements - You're analyzing an IPA file or installed app on a jailbroken device
- You're performing iOS security testing (MASVS-PLATFORM compliance)
- You need to review embedded permissions in a compiled app
- The entitlements file isn't directly accessible and must be extracted from the binary
Prerequisites
- Access to the app binary (from IPA, jailbroken device, or decrypted binary)
- One of the following tools installed:
(recommended for XML extraction)binwalk
(for string searching)radare2
(for quick searches on jailbroken devices)grep
- For encrypted binaries:
,Clutch
, or similar decryption toolsfrida-ios-dump
Extraction Methods
Method 1: Using Binwalk (Recommended for XML Extraction)
Binwalk can extract all embedded XML files from the binary:
binwalk -e -y=xml <path-to-binary>
Example:
$ binwalk -e -y=xml ./Telegram\ X DECIMAL HEXADECIMAL DESCRIPTION -------------------------------------------------------------------------------- 1430180 0x15D2A4 XML document, version: "1.0" 1458814 0x16427E XML document, version: "1.0"
What to do next:
- Note the hex addresses where XML documents are found
- Extract the plist at those offsets using a hex editor or
commanddd - Look for entitlements-related content (keys like
,application-identifier
, etc.)keychain-access-groups
Method 2: Using Radare2 (String Search)
Radare2 can search for PropertyList strings in the binary:
r2 -qc 'izz~PropertyList' <path-to-binary>
Example:
$ r2 -qc 'izz~PropertyList' ./Telegram\ X 0x0015d2a4 ascii <?xml version="1.0" encoding="UTF-8" standalone="yes"?>... 0x0016427d ascii H<?xml version="1.0" encoding="UTF-8"?>...
What to do next:
- Use the hex addresses to extract the full plist content
- The first occurrence is typically the entitlements file
- Parse the XML to review embedded permissions
Method 3: Using Grep (Jailbroken Devices)
On jailbroken devices accessed via SSH, use grep with the
-a flag to treat binaries as text:
grep -a -A 5 'PropertyList' /var/containers/Bundle/Application/<app-path>/<binary-name>
Adjusting output:
- Use
to show more or fewer lines after the match-A <num> - Example:
for more contextgrep -a -A 20 'PropertyList' <binary>
Why this works:
- The
flag treats all files as ASCII text-a - Works even on encrypted app binaries
- Verified against multiple App Store apps
Important Notes
Don't Use strings
Directly
stringsAvoid using the
strings command for this task. It has limitations in finding relevant entitlements information. Instead:
- Use
on the binarygrep -a - Use radare2's
commandizz - Use rabin2's
flag-zz
Handling Encrypted Binaries
If the above methods fail on encrypted binaries:
- Use Clutch (if compatible with the iOS version)
- Use frida-ios-dump to decrypt and extract the app
- Then apply the extraction methods above
Expected Entitlements Content
Look for these common entitlements keys:
- App's bundle identifierapplication-identifier
- Keychain sharing groupskeychain-access-groups
- Developer team IDcom.apple.developer.team-identifier
- Sandbox statuscom.apple.security.app-sandbox
- File access permissionscom.apple.security.files.user-selected.read-only
- Network accesscom.apple.security.network.client
Quick Reference Script
For automated extraction, use the bundled script:
./scripts/extract-entitlements.sh <path-to-binary>
This script:
- Checks for available tools (binwalk, radare2, grep)
- Attempts extraction using the best available method
- Outputs the extracted entitlements to a readable format
Security Testing Context
This extraction technique is part of the OWASP MASVS-PLATFORM security testing guidelines, specifically MASTG-TEST-0069 for reviewing entitlements embedded in compiled app binaries.
Troubleshooting
No XML found with binwalk:
- Try radare2 method instead
- The binary may be heavily obfuscated
- Consider decrypting first if encrypted
Grep returns nothing:
- Verify the binary path is correct
- Try
as an alternative searchgrep -a -i 'entitlement' - Check if the app is encrypted and needs decryption first
Extracted content is garbled:
- The binary may be encrypted
- Use Clutch or frida-ios-dump to decrypt first
- Verify you're extracting from the correct offset