π± Mobile Application Security β Deep Dive: Android Pentesting, iOS Security, OWASP MASVS, Reverse Engineering APK/IPA
Panduan komprehensif keamanan aplikasi mobile β dari Android (APK reversing, Smali patching, Frida hooking, Drozer, ADB forensics) sampai iOS (IPA decryption, class-dump, Frida/objection, Keychain, iOS app sandbox). Mencakup OWASP Mobile Application Security Verification Standard (MASVS) Level 1-3, mobile app reverse engineering (Jadx, Ghidra, Hopper), runtime instrumentation (Frida, Xposed, Cycript), network interception (mitmproxy, Burp Suite untuk mobile), mobile malware analysis, dan platform-specific attack surface (Android Intents, iOS URL Scheme, WebView, Deep Link). Vault udah punya web-hacking-exploitation (web) dan browser-security-exploitation-deepdive (browser) β catatan ini melengkapi dari sisi mobile app.
Nota ini melengkapi web-hacking-exploitation (web app pentesting) dan browser-security-exploitation-deepdive (browser security) dengan mobile-specific attack surface . Juga terkait dengan mobile-forensics (data forensik device β beda scope), api-security-deep-dive (mobile API security β sebagian besar mobile app backend-nya API), identity-and-access-management (mobile auth β OAuth, JWT), cryptography-biometrics (mobile crypto β Keychain, Keystore, Secure Enclave), dan endpoint-detection-playbook (mobile endpoint β EDR untuk mobile).
Daftar Isi
OWASP MASVS β Mobile App Security Standard
Tingkatan MASVS
Level Nama Tujuan Cocok Untuk L1 Standard Security Verifikasi dasar β semua app wajib App biasa, internal app L2 Defense-in-Depth Pertahanan berlapis β anti-tamper, anti-debug, jailbreak detection Fintech, health, enterprise L3 Resiliency Against Reverse Engineering Reverse engineering sangat sulit β obfuscation, white-box crypto, integrity check DRM, payment, high-value IP
MASVS Categories (8 Group)
MSTG-ARCH β Architecture, design, threat modeling
MSTG-STORAGE β Data storage & privacy (Keychain, Keystore, NSUserDefaults)
MSTG-CRYPTO β Cryptography (mobile-specific: Keychain, TEE, Secure Enclave)
MSTG-AUTH β Authentication & session management (biometric, OAuth)
MSTG-NETWORK β Network communication (TLS pinning, certificate validation)
MSTG-PLATFORM β Platform interaction (Intents, URL Scheme, WebView, Deep Links)
MSTG-CODE β Code quality & anti-tampering (obfuscation, jailbreak detection)
MSTG-RESILIENCE β Resilience against reverse engineering (Frida detection, anti-debug)
Android Security Model
Android Architecture
ββββββββββββββββββββββββββββββββββ
β Applications β β Sandboxed per-user ID
ββββββββββββββββββββββββββββββββββ€
β Android Framework β β Permissions, Content Providers, Intents
ββββββββββββββββββββββββββββββββββ€
β Android Runtime (ART) β β AOT + JIT compilation
ββββββββββββββββββββββββββββββββββ€
β Hardware Abstraction β β HAL, Keystore, TEE
ββββββββββββββββββββββββββββββββββ€
β Linux Kernel β β SELinux, namespaces, DAC
ββββββββββββββββββββββββββββββββββ
Android Attack Surface
Surface Kerentanan Umum Impact APK Reverse engineering (Jadx, APKTool) Source code leak, hardcoded secret Intent Intent spoofing, intent redirection Privilege escalation, data leak Content Provider SQL injection, path traversal Database access, file read WebView XSS via JavaScript bridge, file:// access RCE (JavaScriptβJava bridge) SharedPreferences Unencrypted local storage Credential leak Deep Link URL scheme hijacking Session hijack, phishing Backup ADB backup tanpa password Full app data extraction Logging Logcat β sensitive info di log Information disclosure
Android Permission Model
Normal β auto-grant (INTERNET, ACCESS_NETWORK_STATE)
Dangerous β user grant runtime (CAMERA, LOCATION, READ_CONTACTS)
Signature β same signature only (vendor-specific)
SignatureOrSystem β system app only
Android Pentesting
Setup Lab
Device: rooted Pixel / Emulator with root
Tools: ADB, Frida, objection, APKTool, Jadx, Burp Suite, Drozer, Magisk
Step-by-Step Pentest
# Extract APK from installed app
adb shell pm list packages | grep com.target
adb shell pm path com.target.app
adb pull /data/app/.../base.apk target.apk
# Decompile
apktool d target.apk -o target_extracted/
jadx-gui target.apk # Java source code
2. Static Analysis Checklist
3. Dynamic Analysis (Runtime)
# Frida β bypass root detection
frida -U -l bypass_root.js com.target.app
# objection β mobile exploration
objection -g com.target.app explore
# Dalam objection shell:
# android root disable
# android sslpinning disable
# android hooking list classes
# Drozer β Android security audit
drozer console connect
dz > run app.activity.info -a com.target.app
dz > run app.provider.info -a com.target.app
dz > run scanner.provider.finduris -a com.target.app
4. Network Interception
# Burp Suite setup
adb shell settings put global http_proxy 192.168.1.100:8080
# Install Burp CA di system trust store (rooted device)
adb push burp-ca.der /sdcard/
adb shell
su
mount -o rw,remount /system
cp /sdcard/burp-ca.der /etc/security/cacerts/9a5ba575.0
chmod 644 /etc/security/cacerts/9a5ba575.0
# Jika ada certificate pinning β Frida bypass
frida -U -l ssl_pinning_bypass.js com.target.app
# ADB backup (tanpa password β insecure)
adb backup -f app_backup.ab com.target.app
( echo 00 ; dd if=app_backup.ab bs= 24 skip= 1 ) | openssl zlib -d > backup.tar
# Direct database access (rooted device)
adb shell
su
cat /data/data/com.target.app/databases/app.db
sqlite3 /data/data/com.target.app/databases/app.db .dump
# SharedPreferences & internal storage
cat /data/data/com.target.app/shared_prefs/ * .xml
cat /data/data/com.target.app/files/ * .json
iOS Security Model
iOS Architecture
ββββββββββββββββββββββββββββββββββ
β Applications β β Sandbox, code signing mandatory
ββββββββββββββββββββββββββββββββββ€
β Cocoa Touch (UIKit) β
ββββββββββββββββββββββββββββββββββ€
β Media / Core Services β β Keychain, iCloud, Push
ββββββββββββββββββββββββββββββββββ€
β Core OS / Kernel (XNU) β β Mach, BSD, sandbox (Seatbelt)
ββββββββββββββββββββββββββββββββββ€
β Secure Enclave + SEP β β Biometric, crypto, hardware key
ββββββββββββββββββββββββββββββββββ
iOS vs Android Security
Aspek Android iOS App Distribution Multiple stores, sideloading allowed App Store only (wajib review) Code Signing Optional (APK sign) Mandatory β semua app harus signed Sandbox Per-user ID (Linux) Seatbelt + sandbox profile Encryption File-based (since Android 7) Hardware-backed (Secure Enclave) Jailbreak Root (easy) Jailbreak (difficult β need exploit) Permission Runtime (since 6.0) Runtime (since iOS 10) App review No official review App Store review Third-party keyboard Yes Yes (since iOS 8) App Cloning Native support Not allowed
iOS Pentesting
Setup Lab
Device: jailbroken iPhone/iPad
Tools: frida-ios-dump, class-dump, Hopper, objection, Frida, Keychain-Dumper, needle
# Dump decrypted IPA dari jailbroken device
frida-ios-dump -u -o target.ipa com.target.app
# Class information
class-dump -H target.ipa extracted_headers/
# Or with objection
objection explore
objection > ios info binary
2. iOS Static Analysis
# Binary analysis with Hopper/Ghidra
# Check: hardcoded keys, pinning, encryption
# Info.plist analysis
plutil -p extracted_app/Payload/App.app/Info.plist
# Check:
# - NSAppTransportSecurity (ATS) β di-disable?
# - Exported URL Schemes
# - Background modes
# - Keychain access groups
3. iOS Runtime Analysis
# Frida β hook Objective-C methods
frida -U com.target.app -l ios_hook.js
# objection β iOS exploration
objection -g com.target.app explore
objection > ios jailbreak disable
objection > ios sslpinning disable
objection > ios hooking list classes
objection > ios keychain dump
# Keychain extraction
objection > ios keychain dump
frida -U --codeshare mrmacete/find-and-bypass-ios-ssl-pinning
4. iOS Data Storage
# App sandbox access (jailbroken)
/var/mobile/Containers/Data/Application/ <UUID>/
# Check:
# - Documents/ β user data
# - Library/Preferences/ β NSUserDefaults (plist)
# - Library/Caches/ β cached data (maybe sensitive)
# - tmp/ β temporary files
# Keychain Dumper
./Keychain-Dumper -a # Dump all keychain items
5. iOS Reversing
# Hopper: decompile ObjC β pseudo-code
# Frida codeshare: banyak script siap pakai
# Trace ObjC method calls
frida -U com.target.app -l ios_trace.js
# Dump NSUserDefaults
frida -U com.target.app -e "NSUserDefaults.alloc().initWithSuiteName_('com.target.app').dictionaryRepresentation()"
Mobile API Security
Mobile apps mostly communicate via REST/GraphQL API. Pastikan:
Check Kenapa Tools API Key hardcoded? String di APK bisa dibaca Jadx, strings, Ghidra No certificate pinning MITM via proxy Burp Suite, mitmproxy Rate limiting missing Account takeover via brute force Custom Frida, DroidBot Weak OAuth flow Authorization code interception Burp OAuth scanner GraphQL introspection enabled Full schema exposed GraphiQL, introspection query JWT weak secret Token forgery jwt_tool, John
Runtime Instrumentation
# Android
frida -U com.target.app -l script.js
# iOS
frida -U com.target.app -l script.js
# Key Frida use cases:
# 1. Bypass SSL pinning
# 2. Bypass root/jailbreak detection
# 3. Hook function β change return value
# 4. Dump method arguments
# 5. Trace method calls
objection -g com.target.app explore
# Commands:
# android hooking list classes
# android hooking watch class com.target.login
# ios hooking list classes
# ios jailbreak disable
# ios sslpinning disable
# android sslpinning disable
# android root disable
Xposed (Android only)
Permanent module-based hooking
Module: SSLUnpinning, XposedInstaller, RootCloak
Kelemahan: require reboot setiap ganti module, gak work di Android 10+
Frida vs Xposed
Aspek Frida Xposed Permanence Session-based Module (permanent) Android version All (5+) Android 4-9 (deprecated 10+) iOS support β
β Setup No reboot Need reboot Detection Mudah dideteksi (port 27042) Moderate (check /system) Flexibility Sangat tinggi (JavaScript) Medium (Java modules)
Mobile Malware
Android Malware Types
Type Behavior Example Banking Trojan Overlay phishing, SMS intercept Cerberus, Anubis, TeaBot Spyware Call recording, location tracking Pegasus (iOS), Triout Ransomware Lock screen, file encryption Simplocker, Koler Adware Aggressive ads, background install Judy, HummingBad Dropper Download & install second-stage payload Hiddad, Moqhao
Detection Techniques
Static β signature-based (YARA rules)
Dynamic β behavior analysis (sandbox, network monitoring)
ML-based β permission anomalies, API call patterns
Tool Android iOS Fungsi Harga Jadx β
β APK to Java decompiler Free APKTool β
β APK decode, rebuild Free Frida β
β
Runtime instrumentation Free objection β
β
Mobile exploration Free Drozer β
β Android security audit Free class-dump β β
iOS ObjC header extraction Free Hopper β β
iOS binary disassembler $ Ghidra β
β
Binary reverse engineering Free Burp Suite β
β
Proxy, scanner Free/Pro Needle β β
iOS security testing Free MobSF β
β
Automated mobile security scan Free MVT β
β
Mobile Verification Toolkit (forensics) Free
Koneksi ke Vault