Mobile Forensics & Detection
Mobile Exploitation Techniques · Mobile Exploitation track
8 min read
In this module
Detecting Compromise
Mobile forensics covers two distinct challenges: detecting whether a device has been compromised, and acquiring data from it for analysis. Both jobs are complicated by the very security features that make mobile devices hard to exploit in the first place. Encryption, sandboxing, integrity verification — they all keep forensic investigators out just as effectively as they keep attackers out.
Indicators of Compromise
Detecting mobile compromise means hunting anomalies across multiple dimensions. Desktop forensic investigators usually have the run of the full filesystem. Their mobile counterparts are often peering through a keyhole.
Behavioural Indicators
- Unexpected battery drain: Spyware that constantly records audio, tracks location, or exfiltrates data burns serious power. A sudden, unexplained jump in battery consumption is often the first whisper of a persistent implant.
- Unusual network activity: Implants have to phone home to their command-and-control servers eventually. Network monitoring can surface unexpected connections to unknown servers, especially during stretches when the user isn't actively using the device.
- Device overheating: Persistent exploitation processes hammer the CPU, generating heat even when the device should be sitting idle.
- Unexpected data usage: Large background data transfers can be the smoke that points to exfiltration.
Technical Indicators
Reliable detection demands looking deeper than user-visible behaviour:
- Unusual processes: On a jailbroken/rooted device or via forensic tools, examining the process list for unknown services or daemons.
- Modified system files: Changes to system binaries or the presence of unexpected files in system directories.
- Anomalous kernel behaviour: Unsigned kernel modules, modified kernel memory, or unexpected system call interceptions.
- Certificate anomalies: Unexpected CA certificates installed on the device (used for traffic interception).
For mercenary spyware such as Pegasus, the standard open tool is Amnesty International's Mobile Verification Toolkit (MVT). It parses iOS backups or filesystem dumps and Android data, and checks them against published indicators of compromise: known malicious domains, process names and file artefacts. A clean MVT result only means none of the known indicators turned up.
Detecting mobile compromise is difficult because the same security features that protect the device also limit forensic visibility. Detection relies on a combination of behavioural indicators (battery drain, unusual network activity) and technical analysis (process examination, filesystem integrity checks, network traffic analysis). Sophisticated implants actively counteract detection by minimising resource usage and hiding their presence.
Forensic Acquisition
Forensic acquisition (pulling data off a mobile device for analysis) is categorised by how much access the investigator manages to get.
Logical Acquisition
The least invasive method. The investigator pulls data through the device's standard interfaces: iTunes/Finder backups for iOS, and for Android whatever the device still exposes. adb backup is deprecated, and since Android 12 apps that target API level 31 or later are left out of it unless they're debuggable, so on a modern Android phone it yields little; examiners lean on commercial tools and other extraction routes instead. What you get:
- App data that is included in backups.
- Photos, messages, contacts, call logs.
- Some application data (depending on app backup settings).
Logical acquisition doesn't require bypassing device security, but you only get whatever the backup mechanism is willing to hand over. Apps that disable backup (android:allowBackup="false") are off-limits.
Filesystem Acquisition
Needs elevated access (root/jailbreak) and grabs a full copy of the device's filesystem. That opens up:
- All application sandboxes and their contents.
- System logs and crash reports.
- Keychain databases (iOS) and KeyStore entries (Android).
- Some deleted data: records left in SQLite free pages and write-ahead logs are often recoverable. Deleted files usually aren't, because with file-based encryption and TRIM the blocks are discarded by the flash controller and the per-file keys are gone.
Physical Acquisition
The deepest method. Physical acquisition pulls a bit-for-bit image of the device's storage, deleted data and unallocated space and encrypted partitions all included. It usually demands:
- A bootrom exploit (like checkm8 for iOS) or an unlocked bootloader (Android).
- Bypassing or extracting encryption keys.
- Specialised forensic hardware and software.
Which level an examiner reaches depends less on their tools than on the state the device arrives in. Encryption keys are the deciding factor. Before the first unlock after boot (BFU), most class keys don't exist in memory yet. After first unlock (AFU), they do, even with the screen locked. Follow the tree for a phone that turns up on the desk:
That's why seized phones are kept powered and charged: a reboot drops an AFU device to BFU and takes most of the readable data with it.
Jailbreak and Root Detection
Apps that handle sensitive data (banking, healthcare, enterprise) frequently bake in detection for jailbroken or rooted devices, and will simply refuse to run on a compromised platform.
iOS Jailbreak Detection
Common jailbreak detection techniques include:
- File existence checks: Probing for files that only exist on jailbroken devices (
/Applications/Cydia.app,/usr/sbin/sshd,/private/var/stash). - URL scheme checks: Trying to open the
cydia://URL scheme. - Sandbox integrity: Trying to write to locations outside the app's sandbox, which should fail outright on non-jailbroken devices.
- Dynamic library checks: Inspecting loaded dylibs for Frida, Substrate, or other hooking frameworks.
- Fork behaviour: Calling
fork(). Sandboxed apps can't fork on non-jailbroken iOS, so a successful fork is a dead giveaway of a compromised sandbox.
// Simple jailbreak detection (easily bypassed)- (BOOL)isJailbroken { // Check for common jailbreak files NSArray *paths = @[ @"/Applications/Cydia.app", @"/usr/sbin/sshd", @"/bin/bash", @"/usr/bin/ssh" ]; for (NSString *path in paths) { if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { return YES; } } // Check if we can write outside sandbox NSError *error; [@"test" writeToFile:@"/private/jailbreak_test" atomically:YES encoding:NSUTF8StringEncoding error:&error]; if (!error) { return YES; } return NO;}Android Root Detection
Android root detection checks include:
- su binary presence: Checking for the
subinary in common paths (/system/bin/su,/system/xbin/su). - Build tags: Checking
Build.TAGSfor "test-keys" (indicating a custom-signed build). - System properties: Checking
ro.debuggable,ro.secure, and Magisk-related properties. - Installed packages: Looking for Magisk Manager, SuperSU, or other root management apps.
- SELinux status: Checking whether SELinux is in enforcing mode.
- Native checks: Inspecting
/proc/self/mapsfor Magisk or hooking framework libraries.
Jailbreak and root detection is an arms race. Detection checks look for known files, packages, and behaviours associated with compromise. Evasion tools (Magisk DenyList, Frida gadget, Liberty Lite) hide these indicators by hooking detection functions and returning clean results. Sophisticated detection uses multiple independent checks; sophisticated evasion hooks all of them.
Remote Attestation
The strongest form of device integrity verification is remote attestation: asking a trusted hardware component to cryptographically vouch for the device's state.
iOS: DeviceCheck and App Attest
Apple's App Attest service uses the Secure Enclave to produce a hardware-backed assertion that the app is running unmodified on a genuine Apple device. The Secure Enclave signs the assertion, and the app's server can verify it.
Android: Play Integrity API
Google's Play Integrity API delivers device, app, and account integrity verdicts. The strongest verdict (MEETS_STRONG_INTEGRITY) needs hardware-backed key attestation. The device's Trusted Execution Environment (TEE) signs the attestation, which makes forging it a brutal undertaking.
Hardware-backed attestation is far harder to bypass than software-based detection. The attestation keys live in the TEE or Secure Enclave and can't be extracted by software running on the main processor. The downside is that attestation needs a network connection to the attestation server, and it merely reports the device state. It doesn't stop the device from being rooted or jailbroken in the first place.
The Forensics-Security Tension
Mobile security and mobile forensics live in permanent tension. Every security feature that shields the user also gets in the way of legitimate forensic investigation:
- File-based encryption (used by iOS and by Android 10 and later) means a physical image is mostly ciphertext without keys derived from the user's passcode, or a bypass.
- Secure Enclave key protection means that even extracting a physical image does not guarantee access to encrypted data.
- Code signing and sandbox integrity prevent installing forensic tools without a jailbreak or root.
- Verified Boot prevents persistent modifications that would facilitate ongoing forensic access.
This tension is by design. The security model can't tell a lawful investigator apart from a malicious attacker, and treats both the same way: locked out without authorisation. The debate over lawful access to encrypted devices grinds on. The technical reality is that modern mobile devices, properly configured, provide exceptionally strong protection against forensic extraction.