Introduction
Static analysis is inspecting the app without running it. We'll take an APK file and pull out its secrets: what permissions it uses, what components it has, and even its source code.
Target App
For this room, we will use a deliberately vulnerable app, "Diva" (Damn Insecure and Vulnerable App) or "InsecureBankv2". You can download the APK for Diva from GitHub
Practical Tasks
Task 1: Manual Unzipping
- Rename
diva-beta.apktodiva-beta.zip. - Extract the zip file.
- Explore the folders:
res/,META-INF/. Try to openAndroidManifest.xmlandclasses.dex– they are not human-readable.
Task 2: Using apktool for Manifest & Resources
-
Decode the APK:
apktool d diva-beta.apk -
Navigate to the output directory (
diva-beta/). -
Open
AndroidManifest.xmlin a text editor. It's now readable! -
Your Mission: Find the following in the
AndroidManifest.xml:- The package name.
- The
android:debuggableflag (is ittrueorfalse?). - All
<uses-permission>tags. - Any
<activity>withandroid:exported="true".
Task 3: Using dex2jar & JD-GUI for Java Source
-
Convert
classes.dexto a.jarfile:# Assuming dex2jar is in your PATH d2j-dex2jar.bat diva-beta.apk # OR, point directly to the classes.dex d2j-dex2jar.bat diva-beta/classes.dex -
This creates a file like
diva-beta-dex2jar.jar. -
Open
JD-GUI. Drag and drop the.jarfile into it. -
Your Mission: Browse the package structure. Find the
onClickmethod for the "Hardcoding Issues" exercise. Can you find the hardcoded password?
Task 4: Introduction to Smali
smaliis the human-readable assembly language for Android's DEX format.- When
apktooldecodes an app, it creates asmali/folder. - Navigate to
diva-beta/smali/. You'll see.smalifiles. - Open one. It looks complex, but you'll see references to methods and strings. This is what advanced reverse engineers modify to crack apps.
Summary
apktooldecodes resources and gives yousmalicode and a readableAndroidManifest.xml.dex2jar+JD-GUIgives you near-original Java source code, perfect for understanding app logic.