Frida
A dynamic instrumentation toolkit that injects a JavaScript engine into a running native process so you can hook functions, read and modify memory, and change behavior at runtime without touching the binary on disk — the backbone of mobile dynamic analysis.
How it works
Frida (Ole André Vadla Ravnås) injects the QuickJS engine (formerly Duktape) into a target. On attach it uses ptrace to hijack a thread, allocates memory for a bootstrapper, spins up a fresh thread that connects to frida-server and loads frida-agent.so, then restores and resumes the hijacked thread. The agent opens a bidirectional channel back to the REPL or a Python script. Three modes:
- Injected —
frida-serverruns as a daemon (defaultlocalhost:27042); needs root/jailbreak because unprivilegedptraceis blocked. - Embedded —
frida-gadgetis embedded into the app (manually or via Objection’spatchapk/patchipa), for non-rooted/non-jailbroken devices. - Preloaded — gadget loads autonomously from a config, like
LD_PRELOAD/DYLD_INSERT_LIBRARIES.
Core APIs: Interceptor (inline trampoline hooking at the function prologue), Stalker (JIT-based instruction tracing), and the Java / Objective-C bridges for high-level class and method access. CLI tools include frida-ps, frida-trace, and frida-compile.
What it is used for
On mobile, a handful of hooks cover most of a dynamic assessment: disabling certificate pinning, defeating root/jailbreak and anti-Frida checks, extracting keys from the Keychain/Keystore, intercepting crypto calls to see plaintext, dumping heap objects and searching memory for secrets, and flipping client-side authorization flags. Objection wraps these as ready-made commands for testers who don’t want to write JS; Grapefruit offers a web UI over the same engine.
-
Script generation from static analysis. Fridexa infers class, method and overload targets from JADX/apktool output and emits app-specific scripts in observe-only or bypass mode, with URL capture for OkHttp, Retrofit,
URL.openConnectionand WebView, optional Burp proxy setup and duplicate-hook prevention. Pasted Frida console output is parsed for failed hooks and unconfirmed modules, with optional local-LLM revision shown as a diff. Its author’s caveat: a generated bypass is not a proven bypass, especially for Ktor, Flutter, native code and obfuscation Fridexa. -
Typical AndroGoat set (Frida 17.4.1, Android 13 emulator): force
isRooted()/isEmulator()to false, flip anisAdminfield, redirectonAuthenticationFailedto the success path, and always-passCertificatePinner.checkAndroGoat. -
iOS lab hook set (evilcorp-ios): wrap the reply block of
-[LAContext evaluatePolicy:localizedReason:reply:]to force biometric success, enumerate-[* URLSession:didReceiveChallenge:completionHandler:]withApiResolver("objc")and call the handler with.useCredentialfor the presented trust, and rewriteptracerequest 31 (PT_DENY_ATTACH) to 0. Run withfrida -U -N <bundle-id> -l script.jsjankesec. -
Coverage-guided fuzzing with Stalker (LibAFL Frida mode). Gum is linked into the fuzzer itself, so no
frida-serverorptraceis needed: an unrooted phone running as theshelluser in/data/local/tmpworks because that SELinux domain may generate and execute its own code. Stalker recompiles only the target library’s basic blocks (everything else is excluded and runs natively), injecting AFL-style edge-coverage code, CmpLog records forSUBS/CBZ/TBZoperands (so input-to-state replacement solves magic values), and binary-level ASan shadow checks. The target must be mapped beforeFridaInstrumentationHelperbuilds its ranges (link it asDT_NEEDEDof the harness) or coverage is 0%. Measured ~6,000 exec/s on one core and ~30,000 on eight against Samsung’s closed-sourcelibimagecodec.quram.so, rediscovering CVE-2026-21096 within seconds. On Android, LibAFL 0.16’s Frida ASan failed to start (39-bit address space shadow,has_tls()readingTPIDRRO_EL0, a futex deadlock), so crashes were confirmed with an ASan-built reproducer instead (fast_unwind_on_fatal=1) Mobile Hacking Lab.
Version notes that break scripts
- Frida 17 removed the bundled runtime bridges from GumJS. CLI tools still bundle them, but custom tooling must install bridges via
frida-pm(e.g.frida-java-bridge) and bundle withfrida-compile. Native APIs changed:Process.enumerateModules()now returnsModuleobjects;Module.getSymbolByNamewas removed in favor ofProcess.getModuleByName(...).getExportByName(...)orModule.getGlobalExportByName(...). - 17.26–17.27 improved Linux device-tunnel throughput ~7×, added a UART transport for the XNU (iOS) agent, gave device-discovery tunnels a stable UUID (fixing iOS 27.2 teardown), and brought
idundto macOS for faster iOS connections. - 17.27.0 can
attach()to an already-running debuggable Android app on a non-rooted device by injecting Gadget over JDWP (breaking onBinder.execTransact()), not only at spawn — useful against apps that only check for instrumentation at launch.
Detection and the arms race
Frida is noisy, and RASP vendors hunt for it: scans of loaded memory maps for agent artifacts, probes of the default Frida ports on 127.0.0.1, suspicious thread names, and comparing libc function prologues against a baseline to spot trampolines. See Jailbreak and Root Detection Bypass for how these signals are weighted, and Jailbreak and Root Detection Bypass for how testers evade them (Magisk DenyList/Zygisk, attaching after launch, hiding gum). This is an explicit cat-and-mouse: each side adapts to the other.
Setup notes
Install with pip install frida-tools. On Apple Silicon, rooted Android emulation (Magisk + frida-server pushed over ADB) pairs with Burp/mitmproxy for traffic capture. Objection needs a rooted/jailbroken device with frida-server or a gadget-patched app; it cannot instrument a production-signed store build you can’t repackage.
Related
- Mobile Application Security · Objection · Certificate Pinning Bypass · Jailbreak and Root Detection Bypass · Jailbreak and Root Detection Bypass · Android App Security · iOS App Security · Grapefruit
Sources
- Frida — OWASP MAS Tool · original
- Frida 17.27.0: attach to running debuggable Android apps · original
- Frida 17.26.4 released · original
- Frida 17.26.2 released · original
- Objection 2026: Runtime Mobile Exploration via Frida · original
- Frida's Impact on Mobile Security and How to Fight Back · original
- Reversing Android Apps: Bypassing Detection Like a Pro · original
- Reverse engineering Android apps with JADX and Frida · original
- Frida and Burp Suite on an Android emulator on Apple Silicon · original
- Fridexa: evidence-first Android VAPT platform · original
- 33 Cracks in the Armor: Hacking AndroGoat · original
- iOS Application Security in Practice: Auditing 30 OWASP MASVS Vulnerabilities · original
- Fuzzing Android Libraries with LibAFL Frida Mode: CVE-2026-21096 in Samsung Quram · original