Skip to content
Pwnversity
MOB-ANDROIDintermediate · 8 min · upd. 2026-10

Android Pentesting

Android is the most open mobile platform and therefore the easiest to audit: apps ship as an APK (really a ZIP with code compiled to DEX, resources, and the manifest), and with standard tools you can decompile them, read their code almost like the original, instrument them at runtime, and intercept their traffic. This card covers the Android-specific flow: getting the APK, static analysis, dynamic analysis, and the platform’s typical vectors.

flowchart TD
    APK["APK (base.apk + splits)"] --> DEC["apktool / jadx"]
    DEC --> MAN["AndroidManifest.xml"]
    DEC --> CODE["smali/Java code"]
    MAN --> EXP["Exported components"]
    MAN --> DL["Deeplinks"]
    CODE --> SEC["Secrets / endpoints"]
    EXP --> DYN["Dynamic: adb + Frida"]
    DL --> DYN
    SEC --> DYN
    DYN --> BK["Backend / API"]

On Android the attacker can be another installed app, a user with root over their own device, or someone with physical/backup access. What they want:

  • Secrets in the binary: API keys, credentials, and internal URLs in code, resources, or .so files.
  • Exposed components: Activities/Services/Providers/Receivers with exported="true" invokable by any app.
  • Poorly validated deeplinks: entry points that bypass the UI (see Deeplinks and IPC).
  • Insecure storage: cleartext data in shared_prefs/SQLite (see Insecure Storage).
  • Interceptable traffic: no TLS or bypassable pinning (see SSL Pinning and Bypass).
  • Dangerous WebViews: addJavascriptInterface, loading untrusted content.

An APK is a ZIP; unzip -l base.apk already shows the structure:

  • AndroidManifest.xml — permissions, components, deeplinks, exported/debuggable/allowBackup flags.
  • classes.dex (one or more) — Dalvik bytecode: the app’s code.
  • resources.arsc and res/ — resources, strings, layouts.
  • lib/<abi>/*.so — native libraries (C/C++ code).
  • assets/ — embedded files (sometimes config or secrets).

Modern apps ship as an App Bundle and the Play Store delivers several split APKs; analysing them often requires merging the splits.

Ventana de terminal
# from a device with the app installed
adb shell pm list packages | grep target
adb shell pm path com.target.app # shows the APK path(s)
adb pull /data/app/~~abc==/com.target.app-xyz==/base.apk
# if there are splits (App Bundle): merge them with bundletool or use a mirror
Ventana de terminal
# decompile to smali + readable resources (decodes the binary manifest)
apktool d base.apk -o out/
# DEX -> Java for comfortable reading
jadx-gui base.apk # GUI decompiler
jadx -d out_jadx base.apk # CLI mode
# classic alternative
d2j-dex2jar base.apk && jd-gui base-dex2jar.jar

What to review in the manifest and code:

Ventana de terminal
# dangerous flags in the decoded manifest
grep -E 'android:(debuggable|allowBackup|exported|usesCleartextTraffic)' out/AndroidManifest.xml
# secrets in code, resources, and assets
grep -rniE 'api[_-]?key|secret|password|token|BEGIN (RSA|PRIVATE)|https?://' out/
# secrets in native libraries
strings out/lib/*/*.so | grep -iE 'http|key|secret'
  • android:debuggable="true" → debuggable app: extract data with run-as without root.
  • android:allowBackup="true" → backup extractable with adb backup.
  • android:usesCleartextTraffic="true" → allows cleartext HTTP.
  • Components with exported="true" or an intent-filter → IPC surface.
Ventana de terminal
# emulator (AVD) or rooted device
adb devices
adb shell
# proxy to intercept traffic (see mob-ssl): Burp + its CA
# runtime instrumentation (see mob-frida)
frida-ps -U # device processes over USB
objection -g com.target.app explore # interactive exploration

Exported components are Android’s key surface: an Activity, Service, Content Provider, or Broadcast Receiver with exported="true" can be invoked by any other app or by adb, bypassing UI controls.

Ventana de terminal
# launch an exported Activity
adb shell am start -n com.target.app/.AdminActivity
# start an exported Service
adb shell am start-service -n com.target.app/.SyncService
# send a Broadcast
adb shell am broadcast -a com.target.app.ACTION_RESET
# query an exported Content Provider
adb shell content query --uri content://com.target.app.provider/users

An exported Content Provider without permissions can leak data or be vulnerable to SQLi/path traversal; a Receiver can trigger logic with forged intents. drozer automates the whole analysis of this surface:

Ventana de terminal
drozer console connect
run app.package.attacksurface com.target.app
run app.provider.query content://com.target.app.provider/users

Testing against an app you own or have permission to test:

  • Extract secrets: review strings.xml, BuildConfig, assets, and .so; many apps leave third-party keys or internal endpoints.
  • Abuse exported/deeplinks: invoke internal Activities and try malicious parameters.
  • Backup/debug: if allowBackup=true, adb backup -f backup.ab com.target.app and extract with abe.jar; if debuggable=true, run-as gives access to the data without root.
  • WebViews: look for setJavaScriptEnabled(true), addJavascriptInterface, and loading of controllable URLs.
  • Traffic and backend: bypass pinning (SSL Pinning and Bypass) and attack the API like a web app (Web Methodology).
Ventana de terminal
# backup without root (if allowBackup=true)
adb backup -f backup.ab -noapk com.target.app
# read a debuggable app's data without root
adb shell run-as com.target.app cat /data/data/com.target.app/shared_prefs/prefs.xml
  • Don’t hardcode secrets; move keys and sensitive logic to the backend.
  • In production: debuggable=false, allowBackup=false (or a fullBackupContent that excludes sensitive data), usesCleartextTraffic=false.
  • Minimise exported components; exported=false by default, protect the necessary ones with signature permissions, and validate all input (intents, Content Providers).
  • Encrypted storage (Insecure Storage) and TLS + pinning (SSL Pinning and Bypass).
  • Secure WebViews: no unnecessary addJavascriptInterface, no loading of untrusted content, setAllowFileAccess(false).
  • MASVS-RESILIENCE: root/tamper/debug detection and obfuscation with R8/ProGuard raise the cost, they don’t replace backend security.
  • Get the APK (adb pull / bundletool / mirror)
  • Decompile (apktool/jadx) and review the manifest
  • debuggable/allowBackup/exported/usesCleartextTraffic flags
  • Secrets in code/resources/assets/.so
  • Exported components and IPC (drozer, am/content)
  • Deeplinks (Deeplinks and IPC)
  • Insecure storage (Insecure Storage)
  • Backup/debug extractable without root
  • Insecure WebViews (addJavascriptInterface)
  • Traffic + SSL pinning (SSL Pinning and Bypass) and backend