CTF mobile — Android-first, iOS-light
Workspace layout, flag log, submission, remote gate: sibling skill ctf
(../ctf/SKILL.md). Native lib/<abi>/*.so reversing once located: sibling skill
ctf-rev. This skill gets you from base.apk/app.ipa to the flag.
Guardrail: challenge APKs/IPAs are untrusted. Static analysis on the host is fine;
run the app only inside waydroid or a throwaway emulator image — never on a personal
device, never "just to check" outside the challenge run env.
Triage — first 5 minutes
From work/<event>/<chal>/. $ROOT below is the ctf repo root (from a challenge
dir that's ../../..); tool paths are $ROOT-relative, data paths (dist/,
apk-out/) are challenge-dir relative.
$ROOT/skills/ctf-mobile/scripts/apk-triage.sh dist/base.apk # report → apk-out/
If the artifact is an .ipa, skip to references/ios-light.md. If it is an
.xapk/.apkm/.apks, it is still a zip — extract and work on base.apk
(see references/android-recon.md "Split bundles").
Reading the zip listing
| Entry in APK |
Meaning |
Next step |
classes.dex, classes2.dex… |
Dalvik code (count tracks app size) |
jadx |
lib/<abi>/*.so |
native libraries; ABI set decides run env |
fingerprint below |
assets/ |
app data: bundles, JS, configs, DBs |
grep + fingerprint below |
res/raw/ |
uncompiled blobs (audio, models) |
file each one |
AndroidManifest.xml |
binary XML until apktool decodes it |
manifest checklist in recon ref |
resources.arsc |
compiled resources (strings live here too) |
apktool decodes to res/ |
META-INF/*.RSA |
v1 signature cert |
rarely useful |
Framework fingerprint (from lib/ and assets/)
| Signal |
Framework |
Follow-up |
libapp.so + libflutter.so |
Flutter |
recon ref "Flutter" (blutter) |
assets/index.android.bundle |
React Native |
plain JS or Hermes — recon ref |
assets/www/index.html |
Cordova/Ionic |
read the JS, it is the app |
libil2cpp.so + assets/bin/Data/.../global-metadata.dat |
Unity IL2CPP |
Il2CppDumper → ctf-rev |
Assembly-CSharp.dll |
Unity Mono |
dotnet tooling in ctf-rev |
*.pck |
Godot |
pck extractors in recon ref |
only lib<name>.so + dex |
NDK app |
ctf-rev (ghidra arm64) |
no lib/ at all |
pure Java/Kotlin |
jadx straight away |
Run-environment inventory (before any dynamic work)
| Have |
Use |
Notes |
| Rooted physical device + USB |
adb over USB + frida-server |
best compat, runs arm64-only APKs |
| No device |
waydroid |
sudo pacman -S waydroid; root shell; container-isolated |
| No device, want a real emulator |
android-studio (AUR) AVD |
pick a non-"Play" image so adb root works |
| No root at all |
objection patchapk (frida gadget) |
repackaged APK; breaks signature checks |
Setup commands and pitfalls: references/android-dynamic.md.
Decision table
| Signal |
Go to |
| secrets / keys / URLs found by the grep sweep |
recon ref "Secret sweep"; offline crypto, no device needed |
| exported components in manifest |
vulns ref "Exported components" |
| behavior only visible at runtime (pinning, hidden check, obfuscated logic) |
dynamic ref — frida-first |
| root/integrity/emulator check blocks you |
dynamic ref "Bypass recipes" |
| WebView / JS bridge / deep link in jadx |
vulns ref "WebView" / "Deep links" |
.ipa |
ios-light ref |
Playbook
Static → dynamic loop (default)
scripts/apk-triage.sh → inventory, secrets, manifest quick-look.
- jadx: read the launcher activity
onCreate, then follow data flow toward the
flag check (registration code, native native*() decls, crypto).
- Hypothesis → confirm dynamically (adb, frida) → record in
notes.md.
- Escalate: vulns-ref bug-class table; obfuscated strings → call the app's own
decryptor from frida (recon ref "Obfuscation").
Frida-first when the question is behavioral
For "what does the app do when X" (pinning, hidden unlock, encrypted protocol,
string-decrypt calls) skip the static rabbit hole:
- Set up the run env + frida-server (dynamic ref),
frida-ps -Ua to see the app.
- Start from
scripts/frida-hook.js (guarded root-bypass + unpinning skeletons).
- Discovery without reading code:
frida-trace -U -f <pkg> --runtime=v8 -j '*!*keyword*/isu' — trace Java
methods whose signature contains keyword (s = match signature, i = ignore
case, u = user classes only).
- Quick wins via objection:
android sslpinning disable, android hooking watch.
Android bug classes (quick map — full recipes in references/android-vulns.md)
| Attack |
Precondition |
Command sketch |
| Start exported activity |
android:exported="true" (or intent-filter pre-12) |
adb shell am start -n pkg/.Act --ez admin true |
| Talk to exported service/receiver |
idem |
am start-foreground-service -n …, am broadcast -a ACT |
| Query exported provider |
exported content:// |
adb shell content query --uri content://… |
| Fire deep link |
intent-filter with scheme |
am start -a android.intent.action.VIEW -d "scheme://…" |
| WebView bridge abuse |
addJavascriptInterface |
load attacker page → JS bridge |
| Intent redirection |
parcelable extra gets startActivity() |
nested Intent via PoC app or frida |
| FileProvider traversal |
over-broad root-path |
content read --uri 'content://…%2e%2e%2f…' |
| Read app storage |
debuggable or rooted env |
run-as pkg ls, adb pull /data/data/pkg |
| Hardcoded crypto |
SecretKeySpec in jadx |
offline decrypt via $ROOT/scripts/ctf python |
| Logcat leaks |
Log.d near secrets/TextWatcher |
adb logcat grep while exercising app |
iOS (light)
On Linux, static is the realistic path: unzip → Info.plist (plistlib) →
strings/Mach-O (lief, ghidra) → sqlite/plist data files. Dynamic (frida,
keychain, FairPlay decryption) needs a jailbroken device or macOS — see
references/ios-light.md for what is actually achievable and how to fake
code-signing with ldid when repackaging.
References
references/android-recon.md — static recon: zip/apktool/jadx workflows, manifest
checklist, secret sweep patterns, Firebase probes, framework-specific paths
(Flutter/RN/Cordova/Unity/Godot), obfuscation recovery.
references/android-dynamic.md — adb, run environments (waydroid, AVD), frida
toolchain and server setup, objection, hooking patterns, bypass recipes
(SSL pinning, root, signature, emulator), traffic capture.
references/android-vulns.md — CTF bug classes with exact am/content/adb
commands: components, deep links, WebView/JS bridge, intent redirection,
PendingIntents, FileProvider traversal, storage, crypto, cert issues.
references/ios-light.md — ipa structure, Info.plist on Linux, Mach-O via
lief/ghidra, repack+ldid signing flow, honest limits of Linux-only iOS work.
scripts/apk-triage.sh — one-shot static APK report (see Triage).
scripts/frida-hook.js — annotated universal frida template.
Toolbox
| Tool |
Install |
Purpose |
| apktool |
sudo pacman -S apktool |
decode manifest/resources, smali |
| jadx |
release zip from github.com/skylot/jadx → run bin/jadx, bin/jadx-gui |
dex → java (Java 21 already present) |
| adb/fastboot |
sudo pacman -S android-tools |
device control, am/pm/content |
| waydroid |
sudo pacman -S waydroid |
containerized Android run env |
| frida-tools |
uv pip install --python .venv/bin/python frida-tools |
frida, frida-ps, frida-trace |
| frida-server |
release from github.com/frida/frida/releases (match version + device ABI) |
device-side agent, needs root |
| objection |
uv pip install --python .venv/bin/python objection |
gadget repackaging + runtime exploration |
| mitmproxy |
sudo pacman -S mitmproxy |
HTTPS interception proxy |
| sqlite |
sudo pacman -S sqlite |
inspect pulled app databases |
| ldid |
AUR (paru -S ldid) — not in official repos |
ad-hoc iOS code signing on Linux |
1---2name: ctf-mobile3description: Use when the user mentions Android, APK, apk, apktool, jadx, smali, dex, AndroidManifest, frida, frida-server, objection, waydroid, Android emulator, rooted device, SSL pinning, iOS, IPA, mobile app challenge, reversing an app, or a mobile/Android CTF category. Owns Android static and dynamic app analysis plus iOS-light triage; hands native .so reversing to ctf-rev.4metadata:5 source: https://skillmd.com/skills/jiayaoqijia/ctf-mobile6---78# CTF mobile — Android-first, iOS-light910Workspace layout, flag log, submission, remote gate: sibling skill `ctf`11(`../ctf/SKILL.md`). Native `lib/<abi>/*.so` reversing once located: sibling skill12`ctf-rev`. This skill gets you from `base.apk`/`app.ipa` to the flag.1314Guardrail: challenge APKs/IPAs are untrusted. Static analysis on the host is fine;15run the app only inside waydroid or a throwaway emulator image — never on a personal16device, never "just to check" outside the challenge run env.1718## Triage — first 5 minutes1920From `work/<event>/<chal>/`. `$ROOT` below is the ctf repo root (from a challenge21dir that's `../../..`); tool paths are `$ROOT`-relative, data paths (`dist/`,22`apk-out/`) are challenge-dir relative.2324```bash25$ROOT/skills/ctf-mobile/scripts/apk-triage.sh dist/base.apk # report → apk-out/26```2728If the artifact is an `.ipa`, skip to `references/ios-light.md`. If it is an29`.xapk`/`.apkm`/`.apks`, it is still a zip — extract and work on `base.apk`30(see `references/android-recon.md` "Split bundles").3132### Reading the zip listing3334| Entry in APK | Meaning | Next step |35|---|---|---|36| `classes.dex`, `classes2.dex`… | Dalvik code (count tracks app size) | jadx |37| `lib/<abi>/*.so` | native libraries; ABI set decides run env | fingerprint below |38| `assets/` | app data: bundles, JS, configs, DBs | grep + fingerprint below |39| `res/raw/` | uncompiled blobs (audio, models) | `file` each one |40| `AndroidManifest.xml` | binary XML until apktool decodes it | manifest checklist in recon ref |41| `resources.arsc` | compiled resources (strings live here too) | apktool decodes to `res/` |42| `META-INF/*.RSA` | v1 signature cert | rarely useful |4344### Framework fingerprint (from lib/ and assets/)4546| Signal | Framework | Follow-up |47|---|---|---|48| `libapp.so` + `libflutter.so` | Flutter | recon ref "Flutter" (blutter) |49| `assets/index.android.bundle` | React Native | plain JS or Hermes — recon ref |50| `assets/www/index.html` | Cordova/Ionic | read the JS, it is the app |51| `libil2cpp.so` + `assets/bin/Data/.../global-metadata.dat` | Unity IL2CPP | Il2CppDumper → `ctf-rev` |52| `Assembly-CSharp.dll` | Unity Mono | dotnet tooling in `ctf-rev` |53| `*.pck` | Godot | pck extractors in recon ref |54| only `lib<name>.so` + dex | NDK app | `ctf-rev` (ghidra arm64) |55| no `lib/` at all | pure Java/Kotlin | jadx straight away |5657### Run-environment inventory (before any dynamic work)5859| Have | Use | Notes |60|---|---|---|61| Rooted physical device + USB | `adb` over USB + `frida-server` | best compat, runs arm64-only APKs |62| No device | waydroid | `sudo pacman -S waydroid`; root shell; container-isolated |63| No device, want a real emulator | android-studio (AUR) AVD | pick a non-"Play" image so `adb root` works |64| No root at all | `objection patchapk` (frida gadget) | repackaged APK; breaks signature checks |6566Setup commands and pitfalls: `references/android-dynamic.md`.6768### Decision table6970| Signal | Go to |71|---|---|72| secrets / keys / URLs found by the grep sweep | recon ref "Secret sweep"; offline crypto, no device needed |73| exported components in manifest | vulns ref "Exported components" |74| behavior only visible at runtime (pinning, hidden check, obfuscated logic) | dynamic ref — frida-first |75| root/integrity/emulator check blocks you | dynamic ref "Bypass recipes" |76| WebView / JS bridge / deep link in jadx | vulns ref "WebView" / "Deep links" |77| `.ipa` | ios-light ref |7879## Playbook8081### Static → dynamic loop (default)82831. `scripts/apk-triage.sh` → inventory, secrets, manifest quick-look.842. jadx: read the launcher activity `onCreate`, then follow data flow toward the85 flag check (registration code, native `native*()` decls, crypto).863. Hypothesis → confirm dynamically (adb, frida) → record in `notes.md`.874. Escalate: vulns-ref bug-class table; obfuscated strings → call the app's own88 decryptor from frida (recon ref "Obfuscation").8990### Frida-first when the question is behavioral9192For "what does the app do when X" (pinning, hidden unlock, encrypted protocol,93string-decrypt calls) skip the static rabbit hole:94951. Set up the run env + frida-server (dynamic ref), `frida-ps -Ua` to see the app.962. Start from `scripts/frida-hook.js` (guarded root-bypass + unpinning skeletons).973. Discovery without reading code:98 `frida-trace -U -f <pkg> --runtime=v8 -j '*!*keyword*/isu'` — trace Java99 methods whose signature contains `keyword` (s = match signature, i = ignore100 case, u = user classes only).1014. Quick wins via objection: `android sslpinning disable`, `android hooking watch`.102103### Android bug classes (quick map — full recipes in references/android-vulns.md)104105| Attack | Precondition | Command sketch |106|---|---|---|107| Start exported activity | `android:exported="true"` (or intent-filter pre-12) | `adb shell am start -n pkg/.Act --ez admin true` |108| Talk to exported service/receiver | idem | `am start-foreground-service -n …`, `am broadcast -a ACT` |109| Query exported provider | exported `content://` | `adb shell content query --uri content://…` |110| Fire deep link | `intent-filter` with scheme | `am start -a android.intent.action.VIEW -d "scheme://…"` |111| WebView bridge abuse | `addJavascriptInterface` | load attacker page → JS bridge |112| Intent redirection | parcelable extra gets `startActivity()` | nested Intent via PoC app or frida |113| FileProvider traversal | over-broad root-path | `content read --uri 'content://…%2e%2e%2f…'` |114| Read app storage | debuggable or rooted env | `run-as pkg ls`, `adb pull /data/data/pkg` |115| Hardcoded crypto | `SecretKeySpec` in jadx | offline decrypt via `$ROOT/scripts/ctf python` |116| Logcat leaks | `Log.d` near secrets/TextWatcher | `adb logcat` grep while exercising app |117118### iOS (light)119120On Linux, static is the realistic path: unzip → `Info.plist` (plistlib) →121strings/Mach-O (lief, ghidra) → sqlite/plist data files. Dynamic (frida,122keychain, FairPlay decryption) needs a jailbroken device or macOS — see123`references/ios-light.md` for what is actually achievable and how to fake124code-signing with ldid when repackaging.125126## References127128- `references/android-recon.md` — static recon: zip/apktool/jadx workflows, manifest129 checklist, secret sweep patterns, Firebase probes, framework-specific paths130 (Flutter/RN/Cordova/Unity/Godot), obfuscation recovery.131- `references/android-dynamic.md` — adb, run environments (waydroid, AVD), frida132 toolchain and server setup, objection, hooking patterns, bypass recipes133 (SSL pinning, root, signature, emulator), traffic capture.134- `references/android-vulns.md` — CTF bug classes with exact `am`/`content`/adb135 commands: components, deep links, WebView/JS bridge, intent redirection,136 PendingIntents, FileProvider traversal, storage, crypto, cert issues.137- `references/ios-light.md` — ipa structure, Info.plist on Linux, Mach-O via138 lief/ghidra, repack+ldid signing flow, honest limits of Linux-only iOS work.139- `scripts/apk-triage.sh` — one-shot static APK report (see Triage).140- `scripts/frida-hook.js` — annotated universal frida template.141142## Toolbox143144| Tool | Install | Purpose |145|---|---|---|146| apktool | `sudo pacman -S apktool` | decode manifest/resources, smali |147| jadx | release zip from `github.com/skylot/jadx` → run `bin/jadx`, `bin/jadx-gui` | dex → java (Java 21 already present) |148| adb/fastboot | `sudo pacman -S android-tools` | device control, `am`/`pm`/`content` |149| waydroid | `sudo pacman -S waydroid` | containerized Android run env |150| frida-tools | `uv pip install --python .venv/bin/python frida-tools` | `frida`, `frida-ps`, `frida-trace` |151| frida-server | release from `github.com/frida/frida/releases` (match version + device ABI) | device-side agent, needs root |152| objection | `uv pip install --python .venv/bin/python objection` | gadget repackaging + runtime exploration |153| mitmproxy | `sudo pacman -S mitmproxy` | HTTPS interception proxy |154| sqlite | `sudo pacman -S sqlite` | inspect pulled app databases |155| ldid | AUR (`paru -S ldid`) — not in official repos | ad-hoc iOS code signing on Linux |