| name | android-app-pentesting |
| description | Android application security testing and pentesting. Use this skill whenever the user needs to analyze Android APKs for security vulnerabilities, perform static or dynamic analysis, bypass SSL pinning, test exported components, extract APKs from devices, or conduct mobile security assessments. Trigger for any Android security testing, APK analysis, ADB operations, Frida instrumentation, or mobile app vulnerability assessment tasks. |
Android Application Pentesting
A comprehensive skill for security testing Android applications, covering static analysis, dynamic analysis, vulnerability assessment, and exploitation techniques.
Quick Start
adb install -r app.apk
adb shell pm path com.example.app
adb pull /data/app/com.example.app-*/base.apk
frida -U -f com.example.app -l script.js
Workflow Overview
- Setup Environment - Configure ADB, emulator/device, and tools
- Static Analysis - Decompile, analyze manifest, extract strings
- Dynamic Analysis - Instrument with Frida, capture traffic, test components
- Vulnerability Testing - Test exported components, SSL pinning, data storage
- Reporting - Document findings and remediation
1. Environment Setup
ADB Connection
adb devices
adb forward tcp:8080 tcp:8080
adb install -g -r app.apk
adb uninstall com.example.app
Emulator Options
- Android Studio AVD - Official emulator, supports x86/ARM
- Genymotion - Free Personal Edition, requires VirtualBox
- Appetize.io - Online emulator for quick testing
Root Access (Recommended)
For full pentesting capabilities, use a rooted device:
adb shell su -c "id"
2. Static Analysis
Decompile APK
apktool d app.apk -o decompiled/
jadx -d decompiled_java app.apk
jadx-gui app.apk
Extract APK from Device
adb shell pm list packages
adb shell pm path com.example.app
adb pull /data/app/com.example.app-*/base.apk
mkdir splits
adb shell pm path com.example.app | cut -d ':' -f 2 | xargs -n1 -i adb pull {} splits
java -jar APKEditor.jar m -i splits/ -o merged.apk
java -jar uber-apk-signer.jar -a merged.apk --allowResign -o merged_signed.apk
Analyze Manifest.xml
Check for these vulnerabilities:
| Vulnerability | What to Look For | Risk |
|---|
| Debuggable | android:debuggable="true" | High |
| Backup Enabled | android:allowBackup="true" | Medium |
| Exported Components | android:exported="true" | Medium-High |
| Cleartext Traffic | android:usesCleartextTraffic="true" | Medium |
| Low SDK Version | minSdkVersion < 21 | Low-Medium |
cat decompiled/AndroidManifest.xml | grep -E "debuggable|allowBackup|exported|usesCleartext"
Extract Sensitive Strings
strings app.apk | grep -iE "password|api_key|secret|token|credential"
strings app.apk | grep -iE "http://|https://|api\."
strings app.apk | grep -E "[A-Za-z0-9+/]{40,}={0,2}"
apkurlgrep app.apk
SSL Pinning Detection
git clone https://github.com/aancw/SSLPinDetect
cd SSLPinDetect
pip install -r requirements.txt
python sslpindetect.py -f app.apk -a apktool.jar -v
grep -r "CertificatePinner" decompiled/smali/
grep -r "X509TrustManager" decompiled/smali/
grep -r "checkServerTrusted" decompiled/smali/
Identify Obfuscation
apkid app.apk
grep -r "com.proguard" decompiled/smali/
3. Dynamic Analysis
Traffic Capture with Burp
adb push cacert.pem /sdcard/
adb shell settings put global http_proxy 10.0.2.2:8080
adb shell settings put global http_proxy :0
Frida Instrumentation
frida-ps -Uai
frida -U -f com.example.app -l script.js
objection --gadget com.example.app explore
objection explore --startup-command "android sslpinning disable"
objection explore --startup-command "android rootdisable"
python3 fridump3.py -u com.example.app
Drozer for Component Testing
./drozer_console.py connect device:5555
drozer:~> run app.info list_packages
drozer:~> run app.activity list
drozer:~> run app.provider list
drozer:~> run app.service list
drozer:~> run app.receiver list
drozer:~> run app.activity start --component com.example.app/.MainActivity
drozer:~> run app.provider query --uri content://com.example.provider/data
MobSF Automated Analysis
docker pull opensecurity/mobile-security-framework-mobsf
docker run -it -p 8000:8000 opensecurity/mobile-security-framework-mobsf:latest
4. Vulnerability Testing
Exported Activities
grep -A2 "<activity" decompiled/AndroidManifest.xml | grep "exported"
adb shell am start -n com.example.app/.ExportedActivity
Content Providers
grep -A3 "<provider" decompiled/AndroidManifest.xml | grep "exported"
adb shell content query --uri content://com.example.provider/data
Services
grep -A2 "<service" decompiled/AndroidManifest.xml | grep "exported"
drozer:~> run app.service bind --component com.example.app/.Service
Deep Links / URL Schemes
grep -B5 -A5 "<intent-filter" decompiled/AndroidManifest.xml | grep "data"
adb shell am start -a android.intent.action.VIEW -d "scheme://path" com.example.app
Data Storage
adb shell run-as com.example.app
cat /data/data/com.example.app/shared_prefs/*
adb shell run-as com.example.app
sqlite3 /data/data/com.example.app/databases/*.db
.tables
.schema <table_name>
adb shell ls -la /sdcard/Android/data/com.example.app/
SSL Pinning Bypass
frida -U -f com.example.app -l ssl-unpinning.js
objection --gadget com.example.app explore --startup-command "android sslpinning disable"
apk-mitm -i app.apk -o app_patched.apk
Biometric Authentication Bypass
frida --codeshare krapgras/android-biometric-bypass-update-android-11 -U -f com.example.app
adb shell ls -la /data/system_ce/0/snapshots/
WebView Vulnerabilities
grep -r "setJavaScriptEnabled" decompiled/smali/
grep -r "addJavascriptInterface" decompiled/smali/
grep -r "setAllowFileAccess" decompiled/smali/
5. Common Vulnerabilities Checklist
High Priority
Medium Priority
Low Priority
6. Tools Reference
Static Analysis
| Tool | Purpose | Command |
|---|
| apktool | Decompile to Smali | apktool d app.apk |
| jadx | Decompile to Java | jadx app.apk |
| APKiD | Identify obfuscation | apkid app.apk |
| SSLPinDetect | Detect SSL pinning | python sslpindetect.py -f app.apk |
| MobSF | Automated analysis | Docker container |
| Qark | LinkedIn's scanner | qark --apk app.apk |
| AndroBugs | Vulnerability scanner | python androbugs.py -f app.apk |
Dynamic Analysis
| Tool | Purpose | Command |
|---|
| Frida | Runtime instrumentation | frida -U -f package -l script.js |
| Objection | Frida wrapper | objection --gadget package explore |
| Drozer | Component testing | ./drozer_console.py connect device:5555 |
| Burp Suite | Traffic interception | Proxy at 127.0.0.1:8080 |
| pidcat | Log monitoring | pidcat com.example.app |
| Fridump3 | Memory dump | python3 fridump3.py -u package |
Utilities
| Tool | Purpose | Command |
|---|
| ADB | Device control | adb devices |
| APKEditor | Merge split APKs | java -jar APKEditor.jar m -i splits/ |
| uber-apk-signer | Sign APKs | java -jar uber-apk-signer.jar -a app.apk |
| APKLeaks | Find secrets | apkLeaks -f app.apk |
7. Reporting
Finding Template
## [Vulnerability Name]
**Severity:** [Critical/High/Medium/Low]
**Location:** [Component/File/Line]
**Description:**
[Brief description of the vulnerability]
**Impact:**
[What an attacker could do]
**Proof of Concept:**
[Steps to reproduce]
**Remediation:**
[How to fix]
**References:**
[OWASP, CWE, etc.]
Severity Guidelines
- Critical: Remote code execution, authentication bypass, data exfiltration
- High: Sensitive data exposure, privilege escalation
- Medium: Information disclosure, weak cryptography
- Low: Missing security headers, debug info in release
8. Best Practices
For Pentesters
- Always test on a rooted device or emulator
- Use Frida for dynamic analysis - it's powerful and flexible
- Check both static and dynamic aspects of the app
- Document everything - screenshots, commands, findings
- Test on multiple Android versions if possible
For Developers (Remediation)
- Set
android:debuggable="false" in release builds
- Set
android:allowBackup="false" for sensitive apps
- Implement proper SSL pinning (but test it!)
- Use Android Keystore for sensitive data
- Don't store secrets in code or resources
- Validate all inputs, especially from deep links
- Use ProGuard/R8 for code obfuscation
- Implement root detection for sensitive apps
- Set
FLAG_SECURE on sensitive screens
- Keep SDK versions up to date
9. Quick Commands Cheat Sheet
adb devices
adb install -r app.apk
adb uninstall com.example.app
adb shell pm list packages
adb shell pm path com.example.app
adb pull /path/to/apk
adb push local.apk /sdcard/
adb logcat
adb shell am start -n com.example.app/.Activity
frida-ps -Uai
frida -U -f com.example.app -l script.js
frida-trace -U -f com.example.app -o trace.txt
objection --gadget com.example.app explore
objection explore --startup-command "android sslpinning disable"
objection explore --startup-command "android rootdisable"
./drozer_console.py connect device:5555
run app.info list_packages
run app.activity list
run app.provider query --uri content://provider/path
apktool d app.apk -o decompiled/
jadx -d decompiled_java app.apk
strings app.apk | grep -i password
apkid app.apk
python3 fridump3.py -u com.example.app
strings dump/* | grep -E "[a-z0-9]{32,}"
python sslpindetect.py -f app.apk -a apktool.jar -v
10. References
Scripts
See the scripts/ directory for helper scripts:
sslpin-detect.sh - SSL pinning detection wrapper
apk-extract.sh - Extract APK from device
manifest-check.sh - Quick manifest vulnerability scan
frida-ssl-bypass.js - Frida script for SSL pinning bypass