Frida, Burp and Reverse Engineering Lab
Covers the two lab handouts (FRIDA Android Pentesting Lab Setup Guide and Reverse Engg Ref): rooted emulator setup, frida-server and frida-tools, hooking with CodeShare scripts, Burp Suite proxy and CA certificate install, SSL pinning bypass, and the apktool, signing and jadx reverse engineering workflow.
Frida BasicsSearch on YouTube
Frida is an open-source dynamic instrumentation toolkit. It injects custom JavaScript into running apps (Android, iOS, Windows, macOS, Linux). You can monitor, trace or change their behaviour in real time, without the source code and without recompiling.
| Idea | Meaning |
|---|---|
| Static vs dynamic analysis | Static analysis reads decompiled code. Frida does dynamic analysis: it looks inside the app while it runs. |
| Function hooking | Frida intercepts a function call. It pauses the call, lets you view or change the inputs, lets you change the return value, then hands control back to the app. |
| Architecture | Client-server. You write JS hooks on the computer (client). They are sent to the server running on the target device or inside the target app. |
Emulator SetupSearch on YouTube
- Open Android Studio, then Device Manager, then Create Device.
- Select the Pixel 4 hardware profile, API 29.
- On the system image screen, choose a Google APIs image, not a Google Play image.
- Finish the wizard and boot the AVD.
Always pick the Google APIs target. Google APIs images ship without Play Protect and Play Store, and they allow a rooted (adb root) shell. Google Play images cannot be rooted with adb root and block Frida and Burp style instrumentation.
Frida Server SetupSearch on YouTube
Download frida-serverSearch on YouTube
- Find the emulator's CPU architecture:
adb shell getprop ro.product.cpu.abi # e.g. x86_64- From
https://github.com/frida/frida/releases, download the matching server. The guide usesfrida-server-17.8.0-android-x86_64.xz. (Other builds: android-arm, android-arm64, android-x86.) - Extract the
.xzarchive. Optionally rename the binary tofrida-server.
xz -d frida-server-17.8.0-android-x86_64.xz # or use 7-Zip on Windows
mv frida-server-17.8.0-android-x86_64 frida-serverVerify root on the deviceSearch on YouTube
adb shell
su
whoami # expected output: rootPush and run frida-serverSearch on YouTube
adb push Downloads/frida-server/frida-server /data/local/tmp
adb shell
su
chmod 755 /data/local/tmp/frida-server
/data/local/tmp/frida-server &Leave this shell running (or keep the & to background it) for as long as Frida must stay attached. /data/local/tmp is used because it is writable and allows executables.
Install frida-tools on the hostSearch on YouTube
In a separate terminal on the laptop:
pip install frida-tools
frida --version
adb shell /data/local/tmp/frida-server --versionThe frida-tools version on the host must match the frida-server version on the device (17.8.0 in the guide). Both version commands must print the same value. The guide's screenshot shows 17.18.0 on both sides; what matters is that they match.
Useful Frida commandsSearch on YouTube
| Command | Purpose |
|---|---|
frida-ps -U | List running processes on the USB/emulator device; confirms frida-server is visible |
frida-ps -Uai | List all installed apps with their package names (-a apps, -i include installed) |
frida -U -f <package> -l <script.js> | Spawn (-f) the app and load (-l) a hook script |
frida -U -f jakhar.aseem.diva -l Downloads/frida-server/hook-sharedprefs.jsGetting hook scripts from Frida CodeShareSearch on YouTube
Generic scripts come from Frida CodeShare (https://codeshare.frida.re/). Custom scripts from other repos also work.
- Search CodeShare for the action you need, for example "root detection bypass" or "antiroot".
- Open one result and copy the code.
- Paste it into a text file and save it with a
.jsextension and a meaningful name. - Pass it to
fridawith-l.
hook-sharedprefs.js was made this way from @ninjadiary/frinja---sharedpreferences.
Target and Practice APKsSearch on YouTube
| APK / target | Source | Focus areas |
|---|---|---|
DIVA (jakhar.aseem.diva) | F-Droid / GitHub "DIVA Android" | SharedPreferences hooking, insecure storage |
android-ssl-pinning-demo (tech.httptoolkit.pinning_demo) | github.com/httptoolkit/android-ssl-pinning-demo (Releases tab) | Certificate / SSL pinning bypass |
AndroGoat (owasp.sat.agoat) | github.com/satishpatnayak/MyTest (AndroGoat.apk) | Network interception, root detection, SharedPreferences, emulator detection (behaviour still to be verified) |
Damn Vulnerable Bank (com.app.damnvulnerablebank) | Damn Vulnerable Bank project | Anti-root / root-detection bypass chains, health-check IP config |
DIVA: SharedPreferences hookingSearch on YouTube
Spawn DIVA with the SharedPreferences hook. Open the Insecure Data Storage challenge, enter credentials and save. The stored values appear in the Frida terminal.
frida -U -f jakhar.aseem.diva -l Downloads/frida-server/hook-sharedprefs.jsDamn Vulnerable Bank: chained detection bypassSearch on YouTube
The app shows warnings (device is rooted, Frida detected, emulator detected) and does not open. Chain several bypass scripts with repeated -l flags:
frida -U -l C:/Users/<Username>/Downloads/frida-server/frida-antiroot.js -l C:/Users/<Username>/Downloads/frida-server/frida-detect-bypass.js -f com.app.damnvulnerablebankfrida-antiroot.jscomes from CodeShare@dzonerzy/fridantiroot.frida-detect-bypass.jscomes from the TrustedSec blog "Android Hacking for Beginners".
Burp Suite SetupSearch on YouTube
Proxy listenerSearch on YouTube
- Download and install Burp Suite on Windows.
- Go to Proxy, Proxy settings, select the listener and click Edit.
- Set Bind to port: 8080.
- Under Binding, choose All interfaces (a specific interface also works, but All interfaces is the safe default).
Point the emulator at BurpSearch on YouTube
10.0.2.2 is the special address the Android emulator uses to reach the host machine. The guide says to do both options.
Option A, Wi-Fi settings: long-press the active Wi-Fi network, Modify network, Proxy, Manual. Hostname 10.0.2.2, port 8080. Save.
Option B, adb:
adb shell settings put global http_proxy 10.0.2.2:8080To remove the proxy later, set it back with adb shell settings put global http_proxy :0.
Export and install the Burp CA certificateSearch on YouTube
- In Burp, export the CA certificate in DER format and save it (the guide names it
ca-cert.crthere and pushescert-der.crtbelow; use one name consistently). - Before installing it, browse to any HTTPS page on the emulator. The connection fails. This confirms the proxy is active but not yet trusted.
- Push the certificate:
adb push Downloads/frida-server/cert-der.crt /sdcard/Download
adb push Downloads/frida-server/cert-der.crt /data/local/tmp # needed for certain apps; do both to be safe- On the emulator: Settings, Security, Encryption & credentials, Install a certificate. Choose the file and confirm Install anyway.
The copy in /data/local/tmp is what Frida certificate-injection scripts usually read.
Verify interceptionSearch on YouTube
- Keep Intercept off. Browse any page on the emulator.
- In Burp, open Proxy, HTTP history. The requests appear.
Keep Intercept off for normal browsing. With Intercept on, every request must be forwarded by hand. That suits step-through debugging but slows down general review.
SSL Pinning BypassSearch on YouTube
Certificate (SSL) pinning means the app trusts only a specific certificate or public key built into it. It ignores the user-installed Burp CA. So pinned requests fail through Burp even after the CA is installed. Frida hooks the pinning checks and makes them pass.
Pinning demo appSearch on YouTube
The app has one button per request type. Examples: Plain HTTP, Plain ignore-proxy HTTP, Unpinned, Unpinned WebView, Unpinned HTTP/3, Config-pinned, Context-pinned, OkHttp pinned, Volley pinned, TrustKit pinned, Native CT, Appmattus CT.
- With Burp as the device proxy, tap the unpinned and pinned request buttons. Note which succeed and which fail.
- Run the bypass:
frida -U -l C:/Users/<Username>/Downloads/frida-server/ssl-pinning-bypass.js -f tech.httptoolkit.pinning_demo- Tap the pinned buttons again and compare Burp's HTTP history. Before the bypass, pinned requests do not appear in Burp. After it, they do.
ssl-pinning-bypass.js is CodeShare's @pcipolloni/universal-android-ssl-pinning-bypass-with-frida.
The same script works on AndroGoat:
frida -U -l C:/Users/<Username>/Downloads/frida-server/ssl-pinning-bypass.js -f owasp.sat.agoatFull bypass with HTTP Toolkit scriptsSearch on YouTube
For the pinning demo to work completely, use the scripts from https://github.com/httptoolkit/frida-interception-and-unpinning. Clone or download the repo. You need:
config.jsnative-connect-hook.jsnative-tls-hook.js- in the
android/folder:android-proxy-override.js,android-system-certificate-injection.js,android-certificate-unpinning.js,android-certificate-unpinning-fallback.js
Edit config.js: set the IP to 10.0.2.2 and the port to 8080. Paste the Burp certificate contents in PEM format into the place provided. Save.
Then run (the handout's command, cleaned up; it had a stray duplicate -l):
frida -U \
-l config.js \
-l native-connect-hook.js \
-l native-tls-hook.js \
-l android/android-proxy-override.js \
-l android/android-system-certificate-injection.js \
-l android/android-certificate-unpinning.js \
-l ssl-pinning-bypass.js \
-l android/android-disable-flutter-certificate-pinning.js \
-l android/android-certificate-unpinning-fallback.js \
-f tech.httptoolkit.pinning_demoScript order matters. config.js must load first because the other scripts read the proxy address and certificate from it.
Further practiceSearch on YouTube
Once Frida, Burp and the rooted emulator work end to end, reuse the workflow on other apps. The guide suggests mParivahan and Aarogya Setu for traffic analysis and detection-bypass practice.
Objection (not in the handouts)Search on YouTube
objection is a runtime exploration tool built on Frida. The handouts do not use it, but it does the same bypasses with one command each. It needs the same frida-server running.
pip install objection
objection -g <package> explore # attach to the app
android sslpinning disable # inside the objection shell
android root disable
android hooking list activitiesReverse Engineering SetupSearch on YouTube
Java and Android StudioSearch on YouTube
- Open cmd and type
javac. If it is not recognised, install the Oracle JDK and set the environment variables. - Install Android Studio with default options (choose Standard).
- Add the adb path to the PATH variable. It is usually
C:\Users\<user>\AppData\Local\Android\Sdk\platform-tools.
Apktool install (Windows)Search on YouTube
From https://apktool.org/docs/install/:
- Download the Windows wrapper script (save the link as
apktool.bat). - Download the latest Apktool jar.
- Rename the jar to
apktool.jar. - Move
apktool.jarandapktool.battoC:\Windows. Or put both in any folder (for example one on the desktop) and add that folder to the PATH. - Run
apktoolfrom a command prompt to test.
Genymotion emulatorSearch on YouTube
- Download Genymotion desktop (choose the version without VirtualBox if a VM tool already exists). Install with defaults; a restart may be needed.
- Create an account, choose personal use.
- Create a device: prefer Google Pixel with Android 11 (to get root privilege), network mode NAT.
Apktool: Decompile, Modify, RebuildSearch on YouTube
The exercise uses a Simplecalculator APK.
apktool d simplecalculator.apk # disassemble: decodes resources and smali
# edit smali or XML files, e.g. smali_classes3/com/atilsamancioglu/simplecalculator/
apktool b simplecalculator # rebuild: output in simplecalculator/dist/apktool d"baksmalis" eachclasses*.dexintosmalifolders and decodesAndroidManifest.xmland resources.apktool b"smalis" the folders back into.dexfiles and builds the APK intodist/.
The rebuilt APK will not install, because it is not signed. Uninstall the old app first, then sign the new APK.
Signing the APKSearch on YouTube
Add the build-tools folder (for zipalign) to PATH, for example C:\Users\<user>\AppData\Local\Android\Sdk\build-tools\35.0.0. Use a new cmd window.
# 1. align the APK
zipalign -v 4 dist\simplecalculator.apk dist\zipaligned_simplecal.apk
# 2. create a signing key (one time)
keytool -genkey -v -keystore mykeystore.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
# 3. sign with v1 and v2 schemes
apksigner sign --ks mykeystore.keystore --v1-signing-enabled true --v2-signing-enabled true dist\zipaligned_simplecal.apk
# 4. verify the signature
apksigner verify dist\zipaligned_simplecal.apk
# 5. install the modified app
adb install dist\zipaligned_simplecal.apk| Step | Tool | Why |
|---|---|---|
| Align | zipalign -v 4 | Aligns uncompressed data on 4-byte boundaries. It must run before apksigner, because changing the file after signing breaks the signature. |
| Key | keytool -genkey | Makes a 2048-bit RSA key valid for 10000 days in a keystore |
| Sign | apksigner sign | Android installs only signed APKs |
| Verify | apksigner verify | Confirms the signature is valid |
The handout writes -alias -alias_name. The correct form is -alias <name> with no dash before the name.
JADX: Java Source from an APKSearch on YouTube
- From
https://github.com/skylot/jadx/releases, downloadjadx-1.5.0.zipandjadx-gui-1.5.0-with-jre-win.zip. - Extract both (for example into a
jadxfolder on the desktop). - Run the jadx-gui exe and open the APK to browse its classes, manifest and resources.
- To get the source as a project folder, open cmd in jadx's
binfolder (put the APK there) and run:
jadx -d foldername myapp.apk
# or
jadx myapp.apk # creates a folder named after the APKThe Java files are under <folder>\sources\<package path>, for example simplecalculator\sources\com\atilsamancioglu\simplecalculator.
| Tool | Output | Use |
|---|---|---|
| apktool | Smali code plus decoded resources | Modify and rebuild the app |
| jadx / jadx-gui | Readable Java source | Read and understand the logic |
Cursor IDESearch on YouTube
Install Cursor (the AI code editor) and sign in. Open the project folder that jadx produced. Select a file and ask it to explain the code.
The handout also points to a banking-fraud malware APK on GitHub for reverse engineering practice. It is live malware: analyse it only inside an isolated emulator.
Reverse Engineering WorkflowSearch on YouTube
Step 1. Get the APK and install it on the emulator: adb install app.apk.
Step 2. Read the code in jadx-gui: manifest (exported components, permissions), res/values/strings.xml, and the activity classes.
Step 3. Decide on a change: a static patch (apktool) or a runtime hook (Frida).
Step 4. Static route: apktool d, edit smali, apktool b, zipalign, apksigner sign, adb install.
Step 5. Dynamic route: start frida-server, find the package with frida-ps -Uai, run frida -U -f <package> -l hook.js.
Step 6. For network traffic: set the proxy to 10.0.2.2:8080, install the Burp CA, bypass pinning with Frida, read Burp's HTTP history.
Don't Eat Big Zesty Sandwiches Indoors
Decode (apktool d), Edit smali, Build (apktool b), Zipalign, Sign (apksigner), Install.
Quick self-testSearch on YouTube
What is Frida and how is it structured?
A dynamic instrumentation toolkit that injects JavaScript into running apps. It is client-server: hooks are written on the host (frida-tools) and sent to frida-server on the device.
Why choose a Google APIs image and not a Google Play image?
Google APIs images allow a rooted adb root shell and have no Play Protect. Google Play images cannot be rooted that way and block Frida and Burp instrumentation.
Give the commands to push and start frida-server.
adb push frida-server /data/local/tmp, then in adb shell with su: chmod 755 /data/local/tmp/frida-server and /data/local/tmp/frida-server &.
How do you pick the right frida-server build, and what must match?
Run adb shell getprop ro.product.cpu.abi (e.g. x86_64). The frida-server version must equal the host's frida-tools version.
What does frida-ps -Uai show?
All apps on the USB/emulator device, including installed ones not running, with their package names.
How is the emulator pointed at Burp?
Manual Wi-Fi proxy 10.0.2.2:8080, or adb shell settings put global http_proxy 10.0.2.2:8080. Burp listens on 8080 on all interfaces.
How do you install the Burp CA certificate?
Export it in DER format, adb push it to /sdcard/Download (and /data/local/tmp), then Settings, Security, Encryption and credentials, Install a certificate, Install anyway.
Why do pinned requests not appear in Burp, and how do you prove the bypass worked?
The app trusts only its pinned certificate, so it rejects Burp's CA. After running ssl-pinning-bypass.js with Frida, the pinned requests appear in Burp's HTTP history.
Why does a rebuilt APK fail to install, and what fixes it?
It is unsigned. Run zipalign -v 4, create a key with keytool, sign with apksigner sign, check with apksigner verify, then install.
apktool vs jadx?
apktool gives smali and decoded resources and can rebuild the APK. jadx gives readable Java source for analysis but cannot rebuild.
- Frida injects JS hooks at run time; client (frida-tools) and server (frida-server) versions must match.
- Use a Pixel 4, API 29, Google APIs emulator; push frida-server to
/data/local/tmp,chmod 755, run with&. frida-ps -U,frida-ps -Uai,frida -U -f <package> -l script.js; chain bypass scripts with repeated-l.- Burp listens on 8080 (all interfaces); emulator proxy is
10.0.2.2:8080; install the DER CA from Settings. - SSL pinning blocks Burp; CodeShare's universal bypass or HTTP Toolkit's script set (with
config.jsfirst) lets pinned traffic through. - apktool
dandbdecode and rebuild; sign withzipalign,keytool,apksigner signandverify. - jadx and jadx-gui give Java source; Cursor can explain the decompiled project.