iOS Pentesting
iOS testing typically requires a jailbroken device to perform dynamic analysis, inspect the filesystem, and decrypt IPA files.
Static Analysis
Extract and analyze the IPA:
# Extract IPA from jailbroken device
# Using SSH
scp root@device:/var/containers/Bundle/Application/<UUID>/app.ipa .
# Or use tools like ipainstaller, Clutch for decrypted IPA
# Unzip IPA
unzip app.ipa -d app_extracted
cd app_extracted/Payload/App.app
# Analyze Info.plist
plutil -p Info.plistBinary analysis:
# List libraries
otool -L App
# Search for strings
strings App | grep -i "password|secret|key|token"
# Check for PIE and ARC
otool -hv App # Check for PIE flag
otool -Iv App | grep _objc_release # Check for ARC
# Class-dump
class-dump App > classes.txtDynamic Analysis
Frida setup:
# Frida on iOS (requires jailbroken device)
# Install Frida from Cydia or via SSH
# List processes
frida-ps -USSL Pinning Bypass
Save as ios_ssl_bypass.js:
var resolver = new ApiResolver('objc');
resolver.enumerateMatches('*[* URLSession:didReceiveChallenge:completionHandler:]', {
onMatch: function(match) {
Interceptor.attach(match.address, {
onEnter: function(args) {
var completionHandler = new ObjC.Block(args[4]);
var NSURLSessionAuthChallengeUseCredential = 0;
completionHandler.implementation = function(disposition, credential) {
completionHandler(NSURLSessionAuthChallengeUseCredential, null);
};
}
});
},
onComplete: function() {}
});Run bypass:
frida -U -f com.target.app -l ios_ssl_bypass.jsObjection & Forensics
# Using objection on iOS
objection -g com.target.app explore
# Inside objection:
# ios sslpinning disable
# ios keychain dump
# ios cookies get
# Inspect Keychain (on device)
keychain-dumper
# File system inspection
ls -la /var/mobile/Containers/Data/Application/<UUID>/iOS Tools
class-dump
Reverse EngineeringA command-line utility for examining the Objective-C runtime information stored in Mach-O files.
Installation
brew install class-dumpHopper Disassembler
DisassemblerA reverse engineering tool for macOS and Linux that lets you disassemble, decompile, and debug your 32/64bits Intel Mac, Linux, Windows and iOS executables.
Installation
# Download from websiteClutch
DecryptionHigh-speed iOS decryption tool. Dump decrypted IPAs from your jailbroken device.
Installation
# Install on jailbroken deviceKeychain-dumper
ForensicsA tool to check which keychain items are available to an attacker once an iOS device has been jailbroken.
Installation
# Install on jailbroken device