> Posted by: app_hacker | Rank: Senior Member | Joined: 2023 [/I]
Mobile app security testing requires explicit authorization.
Mobile apps are everywhere. And most of them are insecure.
Let me walk you through the complete mobile pentesting methodology - from APK analysis to exploit development.
---
βββ ANDROID REVERSE ENGINEERING βββ[/B]
APK Extraction & Analysis:
Code:
# === Tools Needed ===
# apktool, jadx, frida, obfusc-deobf, androguard
# Decompile APK
apktool d app.apk -o app_decompiled
# Convert to Java (readable)
jadx -d app_java app.apk
# Analyze manifests
cat app_decompiled/AndroidManifest.xml | grep -i "debuggable\|allowBackup\|contentProvider"
# Check for security misconfigurations
grep -r "debuggable=\"true\"" app_decompiled/AndroidManifest.xml
grep -r "allowBackup=\"true\"" app_decompiled/AndroidManifest.xml
grep -r "exported=\"true\"" app_decompiled/AndroidManifest.xml
Common Android Vulnerabilities:
Code:
ββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββ
β Vulnerability β Impact β
ββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββ€
β Hardcoded Keys β API keys, secrets in source code β
β Insecure Storage β SharedPreferences, SQLite without encryption β
β SSL Pinning Bypassβ Traffic interception possible β
β Component Export β Activities/Services exposed to other apps β
β Intent Injection β Manipulated app behavior via intents β
β Content Provider β Data exfiltration via URIs β
β Debug Mode β Easier reverse engineering β
β Root Detection β Weak or bypassable checks β
β Log Injection β Sensitive data in logs β
ββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββ
---
βββ SSL PINTING BYPASS βββ
Most modern apps use SSL pinning. Here's how to bypass it:
Code:
# Method 1: Frida Scripts (Easiest)
# Download Frida server for ARM/ARM64
# Push to device/emulator
adb push frida-server /data/local/tmp/
adb shell "chmod +x /data/local/tmp/frida-server"
adb shell "/data/local/tmp/frida-server &"
# Run bypass script
frida -U -f com.target.app -l ssl-pinning-bypass.js --no-pause
# ssl-pinning-bypass.js content:
Java.perform(function() {
var SSLContext = Java.use("javax.net.ssl.SSLContext");
var TrustManager = Java.use("javax.net.ssl.X509TrustManager");
var HostnameVerifier = Java.use("javax.net.ssl.HostnameVerifier");
SSLContext.init.overload("[Ljavax.net.ssl.KeyManager;", "[Ljavax.net.ssl.TrustManager;", "java.security.SecureRandom").implementation = function(km, tm, sr) {
var emptyTrustManager = Java.extend(TrustManager)({
checkServerTrusted: function(chain, authType) {},
checkClientTrusted: function(chain, authType) {},
getAcceptedIssuers: function() { return []; }
});
this.init(km, [emptyTrustManager], sr);
};
var honestHostnameVerifier = Java.extend(HostnameVerifier)({
verify: function(hostname, session) { return true; }
});
HttpsURLConnection.setDefaultHostnameVerifier(honestHostnameVerifier);
});
# Method 2: Objection (Runtime exploration)
objection -g com.target.app explore
objection> ios ssl pinning disable # iOS
objection> android ssl pinning disable # Android
---
βββ ANDROID INTENT INJECTION βββ
Code:
# Find exported components
aapt dump badging app.apk | grep "activity-alias"
aapt dump badging app.apk | grep "uses-permission"
# Craft malicious intents
adb shell am start -a android.intent.action.VIEW -d "app://deep/link" com.target.app
adb shell am broadcast -a com.target.app.ACTION -e key "value"
# Content Provider enumeration
adb shell content query --uri content://com.target.app.provider/
adb shell content insert --uri content://com.target.app.provider/ --bind name:s:test
---
βββ iOS REVERSE ENGINEERING βββ
IPA Analysis:
Code:
# === Tools Needed ===
# class-dump, filza, frida, cycript
# Extract IPA
unzip app.ipa -d app_extracted
# Analyze binary
class-dump app_extracted/Payload/app.app/app > headers.h
# Check for sensitive data
strings app_extracted/Payload/app.app/app | grep -i "password\|api_key\|secret\|token"
# Check Info.plist for configurations
plutil -p app_extracted/Payload/app.app/Info.plist
Common iOS Vulnerabilities:
Code:
β’ NSURLConnection without certificate validation
β’ Keychain data exposure
β’ Insecure data storage (NSUserDefaults)
β’ Weak SSL/TLS configurations
β’ JIT enabled in WebViews
β’ URL scheme vulnerabilities
β’ Touch ID/Passcode bypass
---
βββ NETWORK TRAFFIC ANALYSIS βββ
Code:
# === Proxy Setup ===
# Charles Proxy / Burp Suite / mitmproxy
# Android (no SSL pinning):
adb shell settings put global http_proxy IP:PORT
adb shell settings put global http_proxy_enabled 1
# Android (with SSL pinning bypass):
frida -U -f com.target.app -l pinning-bypass.js
# iOS (jailbroken):
# Set proxy in app settings or use Frida
# Capture traffic
burp > Configure > Proxy > Options > Add 127.0.0.1:8080
# Install Burp cert on device
adb install burp-cert.apk
---
βββ STORAGE ANALYSIS βββ
Android Storage Locations:
Code:
# Internal Storage (requires root)
adb shell run-as com.target.app ls -la
adb shell run-as com.target.app cat shared_prefs/preferences.xml
adb shell run-as com.target.app cat databases/app.db
# External Storage
adb pull /sdcard/Android/data/com.target.app/ ./app_data/
# Check for:
# - Hardcoded credentials
# - API keys
# - Session tokens
# - SQLite databases with sensitive data
# - SharedPreferences with plaintext secrets
Keychain/Keystore Analysis:
Code:
# iOS Keychain
# Requires jailbreak or Xcode debugging
security dump-keychain
# Android Keystore
# Harder to extract - requires hardware-backed keystore exploitation
# Check for weak implementations:
# - SoftwareOnly keystore
# - Missing biometric binding
# - Weak key generation parameters
---
ββοΏ½ AUTOMATED SCANNING βββ
Code:
# === MobSF (Mobile Security Framework) ===
# All-in-one mobile app analysis
git clone https://github.com/MobSF/Mobile-Security-Framework-MobSF
cd MobSF
./setup.sh
./run.sh
# Access via browser: http://localhost:60000
# Upload APK/IPA for automated analysis
# === Drozer ===
# Android security assessment framework
git clone https://github.com/FSecureLABS/drozer
cd drozer
python2 drozer/console/connect
run app.package.list
run app.package.info -f com.target
run app.intent.info -a com.target.ACTION
run scanner.provider.finduris -f com.target
---
βββ TL;DR βββ
Code:
β
Decompile APK with apktool + jadx
β
Check AndroidManifest.xml for misconfigs
β
Bypass SSL pinning with Frida/Objection
β
Test exported components with intents
β
Analyze stored data (SharedPreferences, SQLite)
β
Use MobSF for automated scanning
β
Test on jailbroken/rooted devices
β
Document all findings with POCs
---
What's your favorite mobile pentesting tool? Drop below.
Next: IoT security testing.
Last edited by app_hacker; 25 minutes ago.
[SIG]ββββββββββββββββββββββββββββββββββββββββ
app_hacker | Senior Member | Mobile Security
ββββββββββββββββββββββββββββββββββββββββ[/SIG][/b][/b][/b][/b][/b][/b][/b]