# 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-server` runs as a daemon (default `localhost:27042`); needs root/jailbreak because unprivileged `ptrace` is blocked.
- **Embedded** — `frida-gadget` is embedded into the app (manually or via Objection's `patchapk`/`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 Bypass|certificate pinning]], defeating [[Jailbreak and Root Detection Bypass|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.openConnection` and 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 [[raw/medium.com/fridexa-building-an-evidence-first-android-vapt-platform-15948|Fridexa]].
- **Typical AndroGoat set** (Frida 17.4.1, Android 13 emulator): force `isRooted()`/`isEmulator()` to false, flip an `isAdmin` field, redirect `onAuthenticationFailed` to the success path, and always-pass `CertificatePinner.check` [[raw/medium.com/33-cracks-in-the-armor-hacking-androgoat-to-learn-how-android-apps-rea-15949|AndroGoat]].
## 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 with `frida-compile`. Native APIs changed: `Process.enumerateModules()` now returns `Module` objects; `Module.getSymbolByName` was removed in favor of `Process.getModuleByName(...).getExportByName(...)` or `Module.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 `idund` to 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 on `Binder.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
- [[raw/mas.owasp.org/frida-owasp-mobile-application-security-tool-3728|Frida — OWASP MAS Tool]]
- [[raw/frida.re/frida-17-27-0-attach-to-running-debuggable-android-apps-15423|Frida 17.27.0: attach to running debuggable Android apps]]
- [[raw/frida.re/frida-17-26-4-released-14987|Frida 17.26.4 released]]
- [[raw/frida.re/frida-17-26-2-released-13670|Frida 17.26.2 released]]
- [[raw/appsecsanta.com/objection-2026-runtime-mobile-exploration-via-frida-3035|Objection 2026: Runtime Mobile Exploration via Frida]]
- [[raw/medium.com/frida-s-impact-on-mobile-security-and-how-to-fight-back-4328|Frida's Impact on Mobile Security and How to Fight Back]]
- [[raw/kayssel.com/reversing-android-apps-bypassing-detection-like-a-pro-4917|Reversing Android Apps: Bypassing Detection Like a Pro]]
- [[raw/httptoolkit.com/reverse-engineering-and-modifying-android-apps-with-jadx-and-frida-4918|Reverse engineering Android apps with JADX and Frida]]
- [[raw/jidr.ly/frida-and-burp-suite-on-an-android-emulator-on-apple-silicon-13588|Frida and Burp Suite on an Android emulator on Apple Silicon]]
- [[raw/medium.com/fridexa-building-an-evidence-first-android-vapt-platform-15948|Fridexa: evidence-first Android VAPT platform]]
- [[raw/medium.com/33-cracks-in-the-armor-hacking-androgoat-to-learn-how-android-apps-rea-15949|33 Cracks in the Armor: Hacking AndroGoat]]