Skip to content
Pwnversity
MOB-FRIDAadvanced · 7 min · upd. 2026-10

Frida and Dynamic Analysis

Frida is the central tool of dynamic mobile pentesting: an instrumentation toolkit that injects a JavaScript engine into a running app’s process, letting you intercept and modify function calls, read and change variables in memory, bypass checks (root/jailbreak detection, SSL pinning), and understand what the app does internally in real time. It’s what turns “reading the code” into “controlling the app while it runs.”

flowchart LR
    PC["Host: frida CLI"] -->|USB| SRV["frida-server / gadget"]
    SRV --> PROC["App process"]
    PROC --> JAVA["Java/ART runtime"]
    PROC --> NAT["Native .so libraries"]
    PROC --> OBJC["Objective-C runtime"]
    JAVA --> HOOK["Hooks: args, return, memory"]
    NAT --> HOOK
    OBJC --> HOOK

Frida lives off the fact that the client is manipulable: anyone with the device (root/jailbreak or an injected gadget) can rewrite the app’s behaviour at runtime. That breaks any control that relies on the client alone:

  • Bypass of local protections: SSL pinning, root/jailbreak detection, biometrics, or a PIN checked locally.
  • Secret extraction in memory: encryption keys, decrypted data, and tokens that never touch disk.
  • Logic manipulation: force isPremium=true, skip validations, change amounts before the request is signed.
  • Discovery of the internal flow to build the real attack against the backend.

The defensive conclusion is direct: everything critical is validated on the server; the client is only a convenience.

  • Hooking: intercept any function (Java/ART, native, Objective-C/Swift) before and after it runs.
  • Read and modify arguments, return values, and variables in memory.
  • Call the app’s internal functions from outside.
  • Bypass checks: root/jailbreak detection, SSL pinning, anti-debugging.
  • Dump secrets: keys, decrypted data, and live tokens in memory.
Ventana de terminal
# on the host
pip install frida-tools
# Android (root): push a frida-server matching the frida version
adb push frida-server /data/local/tmp/
adb shell "chmod 755 /data/local/tmp/frida-server && /data/local/tmp/frida-server &"
# iOS (jailbreak): install the Frida package from Sileo/Cydia
# list device processes/apps (USB)
frida-ps -U # processes
frida-ps -Uai # installed apps with their identifier

Without root/jailbreak you use the gadget (a Frida library injected into the re-signed app, e.g. with objection patchapk/patchipa).

Objection wraps Frida with ready-made commands for the most common tasks:

Ventana de terminal
objection -g com.target.app explore
# inside the REPL:
android hooking list classes # list loaded classes
android hooking watch class com.target.Crypto --dump-args --dump-return
android sslpinning disable # bypass SSL pinning
android root disable # bypass root detection
android keystore list # inspect the keystore
memory search --string "password" # search memory

Objection is the starting point; for specific logic you write custom Frida scripts.

Hook a Java method on Android, intercept it, and force its return value:

Java.perform(function () {
const Login = Java.use("com.target.LoginManager");
Login.checkPassword.implementation = function (pw) {
console.log("[+] entered password: " + pw); // intercept the argument
return true; // force login OK
};
});

Hook a native function (.so) and see its arguments:

const addr = Module.getExportByName("libnative.so", "verify_signature");
Interceptor.attach(addr, {
onEnter(args) { console.log("[*] verify_signature arg0=", args[0]); },
onLeave(ret) { console.log("[*] ret=", ret); ret.replace(ptr(1)); }
});

Hook an Objective-C method on iOS and force true:

const m = ObjC.classes.LoginManager["- isValidSession"];
Interceptor.attach(m.implementation, {
onLeave(ret) { ret.replace(ptr(0x1)); } // force a true return value
});

Run a script by spawning the app:

Ventana de terminal
frida -U -f com.target.app -l script.js --no-pause

Always against an app you own or have permission to test:

  • Bypass client protections (which must never be the only security): SSL pinning (see SSL Pinning and Bypass), root/jailbreak detection, local biometrics/PIN.
  • Extract secrets at runtime: encryption keys, decrypted data, tokens in memory.
  • Understand and force logic: change return values (isPremium -> true), skip validations.
  • Discover the internal flow and feed the backend attack (Web Methodology).

Some apps detect Frida (default ports like 27042, thread names gum-js-loop/gmain, strings frida or LIBFRIDA in mapped memory) or use anti-debugging (ptrace). It can be evaded (anti-anti-Frida scripts, renaming frida-server, using a gadget on a non-standard port), but remember: these protections raise the cost, they don’t replace backend security.

Ventana de terminal
# typical flow of a dynamic session
frida-ps -Uai # identify the app
objection -g com.target.app explore # quick exploration + bypass
frida -U -f com.target.app -l unpin.js --no-pause # unpinning script on spawn
# from there, intercept in Burp and attack the API like a web app
  • Don’t trust client-side checks (pinning, root/jailbreak, local biometrics): a Frida-equipped attacker bypasses them. Real security lives in the backend.
  • MASVS-RESILIENCE: instrumentation/Frida detection, anti-debugging, code integrity, and obfuscation as layers that raise the attack cost, not as an absolute barrier.
  • Minimise sensitive data in memory/client; encrypt with non-extractable keys (hardware-backed Android Keystore / Secure Enclave).
  • Assume a compromised device: always validate and authorize on the server.
  • frida-server/gadget running and app detected (frida-ps)
  • Objection: explore, list classes, basic hooks
  • Bypass SSL pinning (SSL Pinning and Bypass) and root/jailbreak
  • Custom hooks: intercept key arguments and return values
  • Extract secrets/keys/decrypted data in memory
  • Force logic (isPremium, validations, login)
  • Evade anti-Frida if the app implements it
  • Use what you learned to attack the backend (Web Methodology)