- by x32x01 ||
Frida is a powerful dynamic instrumentation toolkit used heavily in Android security testing, reverse engineering, and ethical hacking. It allows you to hook into running apps, intercept function calls, modify behavior on the fly, and analyze how apps really work under the hood ⚙️.
Frida mainly uses JavaScript for hooking, which makes it flexible and fast. Since Android runtime and JavaScript both rely on JIT compilation, Frida can easily intercept IPC, change function logic, and even override return values 🔥.
Common real-world use cases include:
Using Frida, we can bypass this logic without modifying the APK.
Then install Frida on your machine:
List running processes on the device:
https://codeshare.frida.re/browse
Run the popular anti-root script:
Press y to trust the script, then type:
✅ Root detection is now bypassed successfully.
Decompile it using apktool, convert with dex2jar, and inspect with JD-GUI to understand the app logic 👀.
Run it:
🎯 Your hook now executes every time the activity is launched.
Run without pausing:
Every button click is now under your control 😎.
Now the app refuses to close 🚫.
Original output was 60, now it returns 100 💥.
Use this popular script:
Type:
✅ HTTPS traffic is now visible in Burp.
Run it:
Perfect for advanced automation and large-scale testing ⚙️.
From bypassing root checks to intercepting encrypted traffic, it opens endless possibilities.
To master Frida, you should also learn:
Frida mainly uses JavaScript for hooking, which makes it flexible and fast. Since Android runtime and JavaScript both rely on JIT compilation, Frida can easily intercept IPC, change function logic, and even override return values 🔥.
Common real-world use cases include:
- 🔍 Spy on Crypto APIs
- 🧩 Modify function outputs
- 🔐 Bypass AES encryption
- 🚫 Bypass SSL Pinning & Root Detection
- 🧠 Trace private app logic
- 🔓 Bypass app locks (AppLock, license checks, etc.)
Root Detection Bypass 🧱➡️🔓
Many Android apps block rooted devices by checking for SU binaries or specific system flags. When detected, the app usually shows a warning and exits immediately ❌.Using Frida, we can bypass this logic without modifying the APK.
Setup Frida Server on Android
First, push and run frida-server on the device: Code:
adb connect 192.168.27.105
adb shell "/tmp/frida-server &" Then install Frida on your machine:
Code:
pip install frida
pip install frida-tools List running processes on the device:
frida-ps -UUsing a Ready-Made Anti-Root Script
Instead of reversing everything manually, you can use community scripts from Frida CodeShare 👇https://codeshare.frida.re/browse
Run the popular anti-root script:
Code:
frida -U --codeshare dzonerzy/fridantiroot -f in.package.name %resume✅ Root detection is now bypassed successfully.
Hooking Java Methods in Android 🪝☕
Android apps contain many methods like onCreate(), onStart(), and custom user-defined functions. With Frida, you can hook any of them.Extract and Analyze the APK
First, pull the APK: Code:
adb shell pm path jakhar.aseem.diva
adb pull /data/app/jakhar.aseem.diva/base.apk
Hooking onCreate() Method 🚀
Example Frida script: JavaScript:
console.log("Script loaded!");
Java.perform(function () {
var mainapp = Java.use("jakhar.aseem.diva.MainActivity");
mainapp.onCreate.implementation = function () {
console.log("My script called!");
return this.onCreate.overload("android.os.Bundle").call(this);
};
send("Hooks installed");
}); Code:
frida -U -l mainactivityhook.js -f jakhar.aseem.diva
Hooking Custom Methods 🧠
Apps often use custom methods like startChallenge(). You can hook them too: JavaScript:
Java.perform(function () {
var app = Java.use("jakhar.aseem.diva.MainActivity");
app.startChallenge.overload("android.view.View").implementation = function (v) {
send("startChallenge() intercepted!");
return this.startChallenge(v);
};
}); Code:
frida -U -l hook.js -f jakhar.aseem.diva --no-pause
Hooking exit() Method ❌➡️🛑
You can even stop an app from exiting by hooking System.exit(): JavaScript:
Java.perform(function () {
var sys = Java.use("java.lang.System");
sys.exit.overload("int").implementation = function () {
send("System.exit() blocked!");
};
});
Modifying Return Values 🔄
Want to change function results? Easy. JavaScript:
Java.perform(function () {
var cls = Java.use("com.example.MainActivity");
cls.returnValue.implementation = function () {
return 100;
};
});
SSL Pinning Bypass 🔐➡️📡
Apps use SSL Pinning to block traffic interception. Frida can bypass it so you can analyze traffic with Burp Suite.Use this popular script:
Code:
frida -U --codeshare akabe1/frida-multiple-unpinning -f com.osfg.certificatepinning %resume✅ HTTPS traffic is now visible in Burp.
Frida Hooking with Python 🐍
You can embed Frida scripts inside Python for automation: Python:
import frida, sys
jscode = """
Java.perform(function(){
var app = Java.use("jakhar.aseem.diva.MainActivity");
app.startChallenge.implementation = function(v){
send("Button clicked!");
return this.startChallenge(v);
};
});
"""
process = frida.get_usb_device().attach("jakhar.aseem.diva")
script = process.create_script(jscode)
script.load()
sys.stdin.read() Code:
python3 hook.py
Frida Challenge Example 🎮
Advanced challenges involve:- Inspecting hidden activities
- Watching runtime behavior
- Hooking logic dynamically
- Modifying execution flow
Final Thoughts 🧩
Frida is a pentester’s best friend ❤️From bypassing root checks to intercepting encrypted traffic, it opens endless possibilities.
To master Frida, you should also learn:
- JavaScript deeply
- Android internals
- APK reverse engineering
- Java method overloading
Last edited: