Skip to main content

iOS Security Fundamentals

Sandbox & Privilege Separation

iOS apps run under the mobile 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:

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 by securityd based on app entitlements. Important: Keychain data persists after app uninstallation. Always clear Keychain items on first launch.
Keychain access levels (kSecAttrAccessible):
  • kSecAttrAccessibleWhenUnlocked — only when device is unlocked
  • kSecAttrAccessibleAfterFirstUnlock — after first post-reboot unlock
  • kSecAttrAccessibleAlways — 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

Apps check for:
  • Presence of /Applications/Cydia.app, /Library/MobileSubstrate/MobileSubstrate.dylib
  • Ability to call fork() or system()
  • Known jailbreak processes (Cydia, Substrate)
  • URL schemes like cydia://
  • DYLD_INSERT_LIBRARIES environment 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

This hooks evaluatePolicy via Frida to always return True.

Frida Hook (DVIA-v2 Example)

Network Communication

Certificate Pinning Bypass

Proxy Setup

  1. Install Burp CA certificate on the device (Settings > General > VPN & Device Management)
  2. Trust the certificate (Settings > General > About > Certificate Trust Settings)
  3. Configure the device to use Burp as HTTP proxy
  4. For certificate pinning, use Objection or a Frida script to bypass

Memory Analysis

Automated Analysis with MobSF

Upload your IPA for automatic static analysis covering binary properties, Info.plist, URL schemes, ATS settings, and more.

References