iOS Security Fundamentals
Sandbox & Privilege Separation
iOS apps run under themobile user identity while core system processes run as root. Each app operates in its own sandbox (private/var/mobile/Applications/{random ID}) with strict restrictions enforced by the Trusted BSD (MAC) Mandatory Access Control Framework.
Data Protection Classes
iOS provides four protection classes using AES encryption tied to the device UID and user passcode:| Class | Accessibility |
|---|---|
NSFileProtectionComplete | Only when device is unlocked |
NSFileProtectionCompleteUnlessOpen | After first unlock, even if locked again |
NSFileProtectionCompleteUntilFirstUserAuthentication | After first post-boot unlock (default from iOS 7) |
NSFileProtectionNone | Protected only by device UID |
The Keychain
The Keychain is an encrypted container for sensitive data (tokens, passwords, certificates). Encrypted with AES using a key derived from PBKDF2(user passcode, device UID). Access is controlled bysecurityd based on app entitlements.
Important: Keychain data persists after app uninstallation. Always clear Keychain items on first launch.
kSecAttrAccessible):
kSecAttrAccessibleWhenUnlocked— only when device is unlockedkSecAttrAccessibleAfterFirstUnlock— after first post-reboot unlockkSecAttrAccessibleAlways— always (not recommended for sensitive data)kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly— requires device passcode, not in backups
IPA Structure
An IPA is a ZIP file. Rename to.zip and unzip to explore:
Info.plist Key Areas
Data Paths
Static Analysis
Binary Security Properties
Disassembly & Decompilation
Insecure Function Detection
Dynamic Analysis
Setup & Listing Apps
Jailbreak & Anti-Debug Detection Bypass
- Jailbreak Detection
- Anti-Debug Detection
Apps check for:
- Presence of
/Applications/Cydia.app,/Library/MobileSubstrate/MobileSubstrate.dylib - Ability to call
fork()orsystem() - Known jailbreak processes (
Cydia,Substrate) - URL schemes like
cydia:// DYLD_INSERT_LIBRARIESenvironment variable
Data Storage Testing
Snapshot Protection
When an app is backgrounded, iOS saves a screen snapshot. Prevent sensitive data leakage:Local Authentication Bypass
Objection Biometrics Bypass
evaluatePolicy via Frida to always return True.
Frida Hook (DVIA-v2 Example)
Network Communication
Certificate Pinning Bypass
Proxy Setup
- Install Burp CA certificate on the device (Settings > General > VPN & Device Management)
- Trust the certificate (Settings > General > About > Certificate Trust Settings)
- Configure the device to use Burp as HTTP proxy
- For certificate pinning, use Objection or a Frida script to bypass