iOS vs. Android Architecture
The Two Titans of Mobile
Section titled “The Two Titans of Mobile”When approaching mobile application security, an auditor must first understand the underlying operating system. While both iOS and Android are designed with modern security principles (like sandboxing and code signing), their architectural philosophies differ significantly.
The Android Security Model
Section titled “The Android Security Model”Android is built on a modified Linux kernel. Its security model relies heavily on traditional Linux discretionary access control (DAC) blended with mandatory access control (MAC) via SELinux.
Application Sandboxing (UID Separation)
Section titled “Application Sandboxing (UID Separation)”Unlike desktop Linux where applications run as the logged-in user, Android assigns a unique User ID (UID) to every single application upon installation. This means App A cannot read App B’s files because the Linux kernel enforcing standard file permissions prevents it.
Android Package (APK)
Section titled “Android Package (APK)”An APK is essentially a ZIP archive containing:
AndroidManifest.xml: The declaration of components, permissions, and metadata.classes.dex: The compiled Dalvik bytecode (what you will reverse engineer).lib/: Native C/C++ libraries (.sofiles).res/: Resources like XML layouts and images.
Inter-Process Communication (IPC)
Section titled “Inter-Process Communication (IPC)”Because apps are sandboxed, they must use Android’s IPC mechanisms to talk to each other. The primary vehicle for this is the Intent. Intents can be explicit (targeting a specific app) or implicit (declaring an action to be handled by any capable app). Insecurely exported components (Activities, Services, Receivers) that improperly handle Intents are a major source of vulnerabilities.
The iOS Security Model
Section titled “The iOS Security Model”iOS is based on the XNU kernel (Darwin). Apple’s approach is characterized by a tightly controlled “walled garden” ecosystem, ubiquitous cryptography, and strict hardware-software integration.
App Sandboxing (Seatbelt)
Section titled “App Sandboxing (Seatbelt)”iOS sandboxing is enforced by a kernel extension known as Seatbelt (or MACF - Mandatory Access Control Framework). Unlike Android’s UID separation, iOS apps share the same user (mobile) but are constrained by strict kernel-level profiles that dictate exactly what files, hardware, and APIs the app can access.
iOS App Store Package (IPA)
Section titled “iOS App Store Package (IPA)”An IPA is also a ZIP archive. Inside the Payload/ folder is the .app bundle, containing:
Info.plist: Configuration and properties (similar to AndroidManifest).- The compiled Mach-O binary (ARM machine code, usually encrypted by FairPlay).
_CodeSignature/: Cryptographic hashes of all files in the bundle to ensure integrity.
Entitlements and Code Signing
Section titled “Entitlements and Code Signing”Every iOS app must be cryptographically signed by a trusted Apple developer certificate. Furthermore, capabilities like accessing the camera or reading HealthKit data require specific Entitlements—key-value pairs baked into the app’s signature. If an app tries to do something it isn’t entitled to, the kernel kills it immediately.
Key Differences for Hackers
Section titled “Key Differences for Hackers”| Feature | Android | iOS |
|---|---|---|
| Language Base | Java / Kotlin (Dex Bytecode) | Objective-C / Swift (Compiled Mach-O) |
| Reverse Engineering | Very accessible (Apktool, Jadx) | Difficult (Requires decryption / Jailbreak) |
| Filesystem Access | Flexible (External storage often readable) | Extremely restricted (Strict sandbox) |
| Code Execution | allows dynamic loading (JIT) easily | Strictly forbids dynamic code generation (W^X) |