Android apps are distributed as packages you can unpack and read. That's why static analysis is so effective: the app's code, configuration and often its secrets are sitting in the file. This lesson shows you how to examine an app methodically and what to report.
Use the deliberately vulnerable apps from lesson 1, or apps you're authorised to test.
Inside an APK
An APK is a ZIP archive. An AAB (Android App Bundle) is the format uploaded to Google Play, which generates device-specific APKs from it.
| Item | Contents |
|---|---|
AndroidManifest.xml |
Package name, permissions, components, security flags |
classes*.dex |
Compiled app code (Dalvik bytecode) |
res/ and resources.arsc |
Layouts, strings, configuration files |
assets/ |
Raw files bundled by developers: configs, databases, web content |
lib/ |
Native libraries (.so) for each CPU architecture |
META-INF/ |
Signing information |
To get the APK of an installed test app:
adb shell pm path com.example.app
adb pull /data/app/.../base.apk example.apkDecompiling and decoding
apktool d example.apk -o example-decoded # readable manifest and resources
jadx -d example-src example.apk # decompiled source code
jadx-gui example.apk # browse and search interactivelyMobSF gives you an automated first pass: upload the APK and it reports permissions, manifest issues, risky API calls, hard-coded strings and known vulnerable libraries. Treat its output as leads to verify, not findings. Like any scanner, it produces false positives.
Reading the manifest
The manifest is the fastest way to understand an app's attack surface.
| Look for | Why it matters |
|---|---|
android:debuggable="true" |
A release build that can be debugged exposes its data and runtime |
android:allowBackup="true" |
App data may be included in device backups (check backup rules too) |
android:usesCleartextTraffic="true" |
HTTP traffic is allowed |
android:networkSecurityConfig |
Custom TLS trust rules; check they don't trust user CAs in release |
exported="true" activities, services, receivers, providers |
Other apps on the device can call them |
<intent-filter> with <data android:scheme=...> |
Deep links that can be triggered from web pages or other apps |
| Dangerous permissions | Camera, location, contacts, SMS: are they all needed? (MASVS-PRIVACY) |
minSdkVersion |
Very old values mean older, weaker platform protections apply |
Hard-coded secrets
Search the decompiled code and resources for anything that looks like a credential:
grep -RniE "api[_-]?key|secret|password|token|BEGIN (RSA|EC) PRIVATE|AKIA[0-9A-Z]{16}" example-src example-decodedCommon discoveries:
- Cloud keys (AWS, Google Cloud, Azure) with far more permission than the app needs.
- Third-party API keys for payment, maps, messaging or analytics services.
- Encryption keys used to "protect" local data, which then protects nothing.
- Internal or staging URLs that reveal unprotected environments.
The key principle for your report: anything shipped in the app is public. Obfuscation slows people down; it doesn't hide secrets. The fix is to keep secrets on the server, use short-lived tokens obtained after login, and restrict any key that must be embedded (for example, a maps key limited to the app's package and signature).
When you find a live credential, don't use it beyond confirming what it is. Report it so the client can revoke and rotate it.
Insecure local storage (MASVS-STORAGE)
Use the app normally (log in, view sensitive screens, change settings), then look at what it wrote. On a rooted test emulator:
adb shell
run-as com.example.app # works for debuggable builds
ls -R /data/data/com.example.app/| Location | What to check |
|---|---|
shared_prefs/*.xml |
Tokens, passwords, personal data in plain text |
databases/*.db |
SQLite databases holding sensitive records unencrypted |
files/, cache/ |
Downloaded documents, images, cached API responses |
External storage (/sdcard) |
Readable by other apps on older Android versions; never for sensitive data |
Logs (adb logcat) |
Tokens, card numbers or personal data written to logs |
| Clipboard, screenshots | Sensitive fields that allow copying, or screens that appear in the app switcher |
sqlite3 /data/data/com.example.app/databases/app.db ".tables"
adb logcat | grep -iE "token|password|bearer"Fixes: store as little as possible; keep tokens in EncryptedSharedPreferences or protect keys with the Android Keystore; encrypt sensitive databases (for example with SQLCipher); never log sensitive data in release builds; use FLAG_SECURE on sensitive screens.
Exported components and IPC (MASVS-PLATFORM)
Android apps talk to each other through intents. Components marked exported can be started by any app on the device, which matters if they skip authentication or trust their input.
# Start an exported activity directly (in your lab app)
adb shell am start -n com.example.app/.AdminSettingsActivity
# Query an exported content provider
adb shell content query --uri content://com.example.app.provider/usersWhat to check:
- Activities that open sensitive screens without checking the user is logged in.
- Content providers that return data to any caller, or are vulnerable to SQL injection or path traversal through their URIs.
- Broadcast receivers that perform actions when they receive an intent from any app.
- Services that accept commands without checking the caller.
Fixes: set exported="false" unless a component genuinely needs to be public; protect public ones with signature-level permissions; validate every value received in an intent.
Deep links and WebViews
Deep links (example://reset?token=... or verified App Links over HTTPS) open specific screens. Test whether they:
- Let an outside page trigger sensitive actions without confirmation.
- Pass parameters into a WebView, file path or API call without validation.
- Use custom schemes that another app could also register to intercept tokens. Verified App Links prevent this.
WebViews display web content inside the app. Risky settings include setJavaScriptEnabled(true) combined with loading untrusted URLs, addJavascriptInterface exposing app functions to web content, and setAllowFileAccess / universal file access from file URLs. A WebView that loads any URL from a deep link parameter can let an attacker's page run inside the app's context.
Fixes: allow-list the domains a WebView may load, avoid JavaScript bridges where possible, disable file access, and validate deep link parameters.
Code quality and dependencies (MASVS-CODE)
- Check bundled libraries and SDKs for known vulnerabilities (MobSF and dependency scanners help).
- Look for SQL built by string concatenation in local databases and content providers.
- Check whether the app enforces a minimum supported version and can force updates when a security fix ships.
Lab
Using InsecureBankv2, AndroGoat or DIVA on your emulator:
- Decompile the app with jadx and apktool and list every exported component and deep link.
- Run MobSF and verify three of its findings manually.
- Find at least one hard-coded secret and one sensitive value stored in plain text.
- Start an exported activity or query a content provider directly with adb.
- Write each issue as a finding mapped to a MASVS control, with a specific fix.
Checkpoint
- What three manifest flags would you check first, and why?
- Why is "anything shipped in the app is public" the key principle for secrets?
- Where would you look for sensitive data an app stores locally?
- What makes an exported content provider dangerous?
- Name two risky WebView settings and the fixes for each.