Prerequisites
- Target system, dependencies and environment configured.
Usage
Purpose
An APK is a zip file, and everything the app ships with is inside it: hardcoded keys, API endpoints, debug flags, and the compiled logic. Static analysis reads all of that without executing the app. This skill covers taking an APK apart, knowing what to look for, and where the real findings hide.
When to use it
The opening move on any Android assessment, before dynamic testing. It's fast, needs no device, and usually surfaces the first few findings (leaked secrets, insecure settings) on its own.
Only analyse apps you're authorised to test or that you own. Decompiling third-party apps may breach their terms.
Procedure
- Unpack the APK to get the manifest, resources, and smali.
apktool gives you the decoded AndroidManifest.xml and resources:apktool d app.apk -o app-src
- Read the manifest first — it's the app's security posture in one file:
android:debuggable="true" — debug build shipped to prod, a finding.
android:allowBackup="true" — app data extractable via adb backup.
- exported
activity/service/receiver/provider with no permission — IPC attack surface.
usesCleartextTraffic="true" or a permissive network security config — traffic not forced to TLS.
- Decompile to readable Java to review the logic:
jadx -d app-java app.apk
- Grep the decompiled source and resources for secrets and endpoints — this is where quick wins live:
grep -rEi 'api[_-]?key|secret|password|token|BEGIN.*PRIVATE|http://|amazonaws' app-java app-src
- Check
res/xml/network_security_config.xml and strings.xml for base URLs, disabled cert validation, and trust-all configs.
- For breadth, run an automated pass to catch what manual review misses and to score the app against a checklist:
mobsf # upload the APK to the local MobSF instance
- Triage findings: a live secret or cleartext prod endpoint outranks a theoretical exported component with no useful function behind it.
Cheatsheet
apktool d app.apk -o src # decode manifest + resources + smali
jadx -d out app.apk # decompile to Java
unzip -l app.apk # peek at contents without decoding
android:debuggable="true"
android:allowBackup="true"
android:exported="true" (with no permission)
android:usesCleartextTraffic="true"
grep -rEi 'api_key|apikey|secret|password|token|http://|s3\.amazonaws' out
Reading the output
- A live API key or credential in the source is a direct finding — the app ships it to every user's device, so it's public.
debuggable="true" in a release build lets anyone attach a debugger and inspect/modify the running app.
- Cleartext traffic allowed or cert validation disabled means the app's backend calls can be intercepted — feeds the mobile-API-traffic skill.
- Exported components without permissions are IPC entry points other apps can invoke; confirm what they do before rating severity.
- MobSF's high/warning items are leads, not verdicts — verify each in the decompiled code before reporting.
The fix
- Never ship secrets in the APK. Anything on the device is extractable; move keys server-side and have the app fetch short-lived tokens. Obfuscation slows this down, it doesn't prevent it.
- Set
debuggable="false" and allowBackup="false" for release builds.
- Force TLS: remove cleartext traffic, ship a strict network security config, and don't disable certificate validation (pin where appropriate).
- Export only the components that must be, and guard them with permissions and input validation.
- Enable code shrinking/obfuscation (R8/ProGuard) as defence in depth — it raises the cost of reverse engineering without being a security control on its own.
Pitfalls
- Treating obfuscation as protection. It slows analysis; it doesn't hide a hardcoded key from
strings and grep.
- Reading Java but skipping the manifest. The fastest findings (debuggable, backup, cleartext, exports) are all in the manifest.
- Trusting the automated score. MobSF flags possibilities; a "high" can be a false positive and a real bug can score low. Verify in source.
- Ignoring native libraries. Secrets and logic in
lib/*.so won't show in the Java decompile — check those separately if the Java layer looks too clean.
References
- OWASP Mobile Application Security Testing Guide (MASTG)
- OWASP MASVS (verification standard)
- jadx, apktool, and MobSF documentation
Inputs
- Relevant source code, logs, network traces, or system specifications.
Outputs
- Analysis findings, security audit report, or generated code artifacts.
1---2name: android-static-analysis3description: Use when you have an Android APK and want to read it for secrets, weak configuration, and vulnerable code without running it — the first pass on any mobile assessment.4---5678## Prerequisites9- Target system, dependencies and environment configured.1011## Usage12### Purpose1314An APK is a zip file, and everything the app ships with is inside it: hardcoded keys, API endpoints, debug flags, and the compiled logic. Static analysis reads all of that without executing the app. This skill covers taking an APK apart, knowing what to look for, and where the real findings hide.1516### When to use it1718The opening move on any Android assessment, before dynamic testing. It's fast, needs no device, and usually surfaces the first few findings (leaked secrets, insecure settings) on its own.1920Only analyse apps you're authorised to test or that you own. Decompiling third-party apps may breach their terms.2122### Procedure23241. Unpack the APK to get the manifest, resources, and smali. `apktool` gives you the decoded `AndroidManifest.xml` and resources:25 ```26 apktool d app.apk -o app-src27 ```282. Read the **manifest** first — it's the app's security posture in one file:29 - `android:debuggable="true"` — debug build shipped to prod, a finding.30 - `android:allowBackup="true"` — app data extractable via adb backup.31 - exported `activity`/`service`/`receiver`/`provider` with no permission — IPC attack surface.32 - `usesCleartextTraffic="true"` or a permissive network security config — traffic not forced to TLS.333. Decompile to readable Java to review the logic:34 ```35 jadx -d app-java app.apk36 ```374. Grep the decompiled source and resources for **secrets and endpoints** — this is where quick wins live:38 ```39 grep -rEi 'api[_-]?key|secret|password|token|BEGIN.*PRIVATE|http://|amazonaws' app-java app-src40 ```415. Check `res/xml/network_security_config.xml` and `strings.xml` for base URLs, disabled cert validation, and trust-all configs.426. For breadth, run an automated pass to catch what manual review misses and to score the app against a checklist:43 ```44 mobsf # upload the APK to the local MobSF instance45 ```467. Triage findings: a live secret or cleartext prod endpoint outranks a theoretical exported component with no useful function behind it.4748### Cheatsheet4950```bash51apktool d app.apk -o src # decode manifest + resources + smali52jadx -d out app.apk # decompile to Java53unzip -l app.apk # peek at contents without decoding5455android:debuggable="true"56android:allowBackup="true"57android:exported="true" (with no permission)58android:usesCleartextTraffic="true"5960grep -rEi 'api_key|apikey|secret|password|token|http://|s3\.amazonaws' out61```6263### Reading the output6465- **A live API key or credential in the source** is a direct finding — the app ships it to every user's device, so it's public.66- **`debuggable="true"` in a release build** lets anyone attach a debugger and inspect/modify the running app.67- **Cleartext traffic allowed or cert validation disabled** means the app's backend calls can be intercepted — feeds the mobile-API-traffic skill.68- **Exported components without permissions** are IPC entry points other apps can invoke; confirm what they do before rating severity.69- **MobSF's high/warning items** are leads, not verdicts — verify each in the decompiled code before reporting.7071### The fix7273- **Never ship secrets in the APK.** Anything on the device is extractable; move keys server-side and have the app fetch short-lived tokens. Obfuscation slows this down, it doesn't prevent it.74- Set `debuggable="false"` and `allowBackup="false"` for release builds.75- **Force TLS**: remove cleartext traffic, ship a strict network security config, and don't disable certificate validation (pin where appropriate).76- Export only the components that must be, and guard them with permissions and input validation.77- Enable code shrinking/obfuscation (R8/ProGuard) as defence in depth — it raises the cost of reverse engineering without being a security control on its own.7879### Pitfalls8081- **Treating obfuscation as protection.** It slows analysis; it doesn't hide a hardcoded key from `strings` and grep.82- **Reading Java but skipping the manifest.** The fastest findings (debuggable, backup, cleartext, exports) are all in the manifest.83- **Trusting the automated score.** MobSF flags possibilities; a "high" can be a false positive and a real bug can score low. Verify in source.84- **Ignoring native libraries.** Secrets and logic in `lib/*.so` won't show in the Java decompile — check those separately if the Java layer looks too clean.8586### References8788- OWASP Mobile Application Security Testing Guide (MASTG)89- OWASP MASVS (verification standard)90- jadx, apktool, and MobSF documentation9192## Inputs93- Relevant source code, logs, network traces, or system specifications.9495## Outputs96- Analysis findings, security audit report, or generated code artifacts.