Tool:Frida
| License | wxWindows Library Licence 3.1 |
|---|---|
| Website | https://frida.re |
| On this wiki | Facts · Code · Notes · Topics |
Frida (wxWindows Library Licence) is a dynamic instrumentation toolkit: an injected agent runs JavaScript with an Interceptor for hooks, backed by the frida-gum C library; the Gadget library embeds it in apps that cannot be injected.
Interceptor (JavaScript API)
From the Frida docs: Interceptor.attach(target, callbacks[, data]) intercepts calls to a NativePointer and returns a listener with detach(); onEnter(args) gets an array of NativePointer arguments, onLeave(retval) can call retval.replace(...) (the object is recycled, do not store it); this carries returnAddress, context (registers, assignable), threadId, errno, depth. Interceptor.replace(target, replacement) swaps the implementation, replaceFast has less overhead and requires calling the original through the returned pointer, revert(target) undoes it, detachAll() removes all, flush() commits pending changes (rarely needed, e.g. before calling a just-hooked function through NativeFunction).
Gadget
The Gadget is a shared library (FridaGadget.dylib, libgadget.so) loaded by the app itself. Its config file has the same name with extension .config; on iOS, if the dylib is in a Frameworks directory, the parent directory is also checked. Interaction types: listen (default; address 127.0.0.1, port 27042, on_port_conflict fail or pick-next, on_load wait or resume), script (path, parameters, on_change ignore or reload) and script-directory (path, on_change ignore or rescan, per-script .config with filter on executables, bundles or objc_classes). On Android, non-debuggable apps only get files from lib/<abi> named lib*.so, so the config is shipped as e.g. libgadget.config.so.
Getting the Gadget into your own app: add it to the APK lib/ folder or the IPA Frameworks folder and make something load it. LIEF (lief-project/LIEF commit 80cf4a582cd7afc486cc3791e30775517c71b579; LICENSE is the Apache License 2.0) has add_library(library_name) on the ELF binary class (api/python/lief/ELF.pyi line 819, returns a DynamicEntryLibrary, i.e. a DT_NEEDED entry) and on the Mach-O binary class (api/python/lief/MachO.pyi line 1108, returns a load command), which is how a Gadget library can be made a dependency of an app binary. Unverified: that Dobby and frida-gum (inline hooking, Stalker) work as alternatives for in-process hooks in this setting.
See Technique:Function hooking/Unix and mobile, Library:Dobby.
Code & repositories
- https://github.com/frida/frida-gum
- https://github.com/frida/frida-gum @
d496938af399b9048dd6b0c44849f97d5a943799· license: wxWindows-3.1 (declared by the contributor for the files used; GitHub reports BSD-3-Clause (read from COPYING; GitHub's detector did not classify it) for the repository)
frida-gum: the instrumentation engine under Frida (Interceptor, Stalker). Not read in detail.
Tested on: source read, not run: listed, not read · checked 2026-10-18; last activity 2026-10-18