Lab: Mobile App Reverse Engineering
This lab makes the first lesson of the mobile attack-surface map concrete: the app ships to the attacker’s device. Anyone who has it can take it apart. You will decompile a training app and find secrets its developers wrongly believed were hidden.
Get the tools and a safe target:
# macOSbrew install jadx # decompiler (also try `jadx-gui`)# Linux: download jadx from github.com/skylot/jadx/releasesTarget options (pick one — all are intentionally insecure training apps):
- DIVA (Damn Insecure and Vulnerable App)
- InsecureBankv2
- An OWASP MASTG Android crackme, or your own
app-debug.apk
You only need the .apk file on disk.
The exercise
Section titled “The exercise”-
An APK is just a ZIP — look inside.
Terminal window unzip -l target.apkYou’ll see
classes.dex(the compiled code),resources.arsc, assets, andAndroidManifest.xml. Nothing here is secret — it’s all sitting on the device. -
Decompile to readable Java.
Terminal window jadx-gui target.apk # opens a browsable source tree# or: jadx -d out/ target.apkThe compiled app becomes near-original source you can read class by class.
-
Read the manifest.
Open
AndroidManifest.xml. Note the permissions it requests (does a calculator really need SMS?) and any exported components other apps could call. Over-permissioning is map pin #4. -
Hunt for hardcoded secrets (map pins #1 and #9).
In jadx’s search, look for:
http apiKey api_key password secret token AES Base64You will typically find API keys, backend URLs, or encryption keys baked into the code — the developer assumed no one would look. Anyone with the APK now has them.
-
(Optional) Spot insecure storage & logging.
Search for
SharedPreferences,openFileOutput, orLog.dto find secrets written to the device in plaintext or leaked to logs — map pin #2.
How it’s defended
Section titled “How it’s defended”- Hardcoded secrets → keep secrets on the server; have the app request short-lived tokens; rotate and tightly scope keys; never ship master keys in the binary.
- Reverse engineering → assume the client is fully visible; enforce every real check server-side. Obfuscation and tamper-detection raise the cost but are speed bumps, not walls.
- Over-permissioning / insecure storage → request only needed permissions; store secrets in the OS Keystore/Keychain, encrypted; never log sensitive data.
Debrief
Section titled “Debrief”- Re-read pins 1 and 9 on the mobile map — you’ve now lived them.
- Connect it to India’s loan-app problem (map pin #4/#5): the same decompilation reveals apps that scrape SMS and contacts.
- The fix is architectural, not cosmetic: move trust off the device. That’s the mindset the Trinetra capstone reinforces.