A Frida Alternative for Android: When the App Kills Frida
Frida is excellent, and we are not here to tell you to stop using it. We ship it in the box and reach for it every week. But there is a specific situation it cannot help with: an app that detects Frida and refuses to run. If you have ever watched a target die a second after you attached, or seen a "device is not secure" screen and a clean exit, you have hit the wall this post is about. A Frida alternative worth the name is not a nicer scripting API. It is an instrumentation path that leaves no Frida artifacts for the app to find, and this post is a technical account of how we built two of them, what they cost, and where Frida still wins.
Why apps detect Frida in the first place
Frida works by getting code into the target's address space, either a frida-server it attaches to, or a gadget linked into the process. That injected code is powerful, and it is also, by construction, present. Anything present in a process can be observed by that process, and a hardened app spends a few cheap instructions doing exactly that. The common checks are well known because they are easy:
- Memory maps. The app reads
/proc/self/mapsand looks for a mapping named after the Frida agent or a region with the gadget's characteristic permissions and layout. Your instrumentation announces itself in the one file the app can always read about itself. - Named threads. Frida spins up worker threads with recognizable names. A loop over
/proc/self/task/*/commfinds them. - The default port.
frida-serverlistens on TCP 27042 by default. A connect attempt to localhost on that port is a one-line detection. - Gum structures and exports. The gum engine leaves recognizable symbols and in-memory structures. An app that knows what it is looking for can scan for them directly.
- Pipe and D-Bus residue. Frida's own control channels leave filesystem and descriptor traces a determined check can enumerate.
None of this is a knock on Frida. It is the physics of injected instrumentation: the thing that gives you power inside the process is the thing the process can see. The asymmetry is brutal for the analyst. The check costs the app a handful of syscalls and runs once at startup; defeating all of it, renaming the server, moving the port, scrubbing the maps, hiding the threads, is a running battle you lose the moment the app adds the next check. For a serious target, a banker, a DRM-heavy app, anything with a real anti-tamper budget, Frida is the first door they shut, and they shut it cheaply.
Alternative 1: an in-house hooking engine with no gum fingerprint
The first path keeps the model of hooking from inside the process but removes the dependency that gives the game away. Frida's power comes from gum, its instrumentation core. If your engine is not gum, the anti-Frida checks that scan for gum's symbols and structures find nothing, because nothing gum-shaped is there. So we wrote our own inline hooking engine in Rust rather than scripting on top of someone else's. We have a whole post on how it relocates prologues; here is the part that matters for detection.
What an inline hook actually does
To hook a native function you overwrite the first few bytes of its code with a jump to your detour. On x86-64 the atomic unit is a five-byte near jump, opcode 0xE9, a jmp rel32. Those five bytes you overwrote still have to run, though, or you have corrupted the function. So before patching you decode the function's prologue, copy enough whole instructions to cover the five bytes you are about to clobber, and stash them in a trampoline that your detour can call to resume the original. Decoding is the subtle part: you cannot just memcpy five bytes, because you might cut an instruction in half, and you cannot relocate a prologue blindly, because any RIP-relative operand or relative branch in those copied instructions now sits at a different address and points to the wrong place.
Relocation with a real encoder, not a byte patcher
This is where most hand-rolled hooking engines are quietly broken. Ours uses iced-x86, a precise x86-64 decoder and encoder, to do it correctly. We decode the prologue into real instruction objects, then hand the block to iced_x86::BlockEncoder, which re-encodes the instructions at their new trampoline address and fixes up every RIP-relative operand and branch displacement in the process. A mov rax, [rip + 0x40] that was reading a constant forty bytes ahead still reads the same constant after relocation, because the encoder recomputes the displacement for the new location. That is the difference between a hook that works and one that corrupts the target the first time its prologue happens to contain a relative reference, which on real optimized code is often. We decode, we relocate with the encoder, we write the five-byte jump last as the single atomic step, and the original is reachable through the trampoline. No gum anywhere in that pipeline, so no gum fingerprint.
The practical payoff is an instrumentation path that a Frida-detection check does not catch, because it is looking for the wrong thing, and it runs across the whole Android 9 to 16 span (API 28 through 36), device-proven. Our agent is not Frida, does not link gum, does not open port 27042, and does not create Frida-named threads. The checks that reflexively kill Frida see a normal process.
Alternative 2: own the runtime, and inject nothing at all
The in-house agent removes gum, but it is still code inside the process, and a sufficiently paranoid app can look for any foreign code, not just Frida's. The second path removes even that. Instead of injecting anything into the app, you run the app on a modified Android Runtime (ART) that observes the app's call catalog from the inside of the runtime itself. There is no attached agent, no JVMTI debuggable flip for the app to notice, nothing in the app's own address space that was not there on a clean device. The observer is the floor the app is standing on, not a tenant it can evict.
The result is measurable. We took a banker that self-terminates roughly 0.66 seconds after Frida touches it, fast, deliberate, clearly built to defeat exactly this, and ran it on the modified runtime. It ran for about 70 seconds, undetected, long enough to exercise and record its real behavior. Against the anti-agent and anti-Frida class of defense, owning the runtime wins, because the thing those checks look for is not present to be found.
This path costs more to set up than attaching an agent, so it is not the default. It is the answer for the specific case where even an artifact-free in-process agent would be too visible, a sample that scans for any foreign mapping, flips self-debuggable state checks, or watches for the debuggable flip itself. When the app's whole strategy is "detect the observer," you remove the observer from the place it is looking.
Which path for which situation
None of these is strictly better than the others. They trade detectability against convenience, and the right choice is per target. We treat the mechanism as an implementation detail of one goal: get the most information out of the target without a detectable tell. Here is the decision we actually make:
| Situation | Best path | Why |
|---|---|---|
| App does not check for instrumentation; you want to iterate fast | Frida | Interactive REPL, change an argument, try ten things in seconds. Nothing beats it for exploration. |
| App scans for Frida (maps, port, threads, gum) | In-house agent | No gum, no port 27042, no Frida-named threads. The Frida-specific checks find nothing. |
| App scans for any foreign code or watches the debuggable flip | Modified runtime | Nothing is injected into the app at all; the observer is the runtime underneath it. |
| Release build with R8-renamed hooks a script cannot name | In-house agent | Structural matching attaches where a name-based Frida script hooks nothing and fails silently. |
When you should still use Frida
Here is the honest part, and it is the reason we keep Frida in the box rather than claiming to have replaced it. Frida is still the best tool for fast, exploratory, interactive work. You want to poke a method, read its arguments, flip a boolean, and see what happens, and then try something else, all in a live REPL without recompiling anything. That iteration loop is Frida's home turf, and an ahead-of-time, structural engine does not match it. Its dynamic flexibility also beats a structural approach on a real set of cases. When we graded our own TLS cert-unpinning against Frida site by site, on a non-root device with real flow counts, there were rows where Frida won, and we published them rather than bury them. A Frida alternative is not "Frida is bad." It is "use the artifact-free path when the app is checking for artifacts, and use Frida when it is not."
The parity picture, without spin
If someone sells you a Frida alternative that is strictly better at everything, ask them for the losing rows. We have ours written down, so here is ours. On the Java tier, our in-house path observes a substantial fraction of the hook surface Frida covers, not all of it, and we track the gap rather than paper over it. The honest three-line summary: the in-house path wins where detection or R8 renaming defeats a Frida script, because it either is not seen or does not need the stripped name to attach; it matches on the common observe-and-capture cases; and it still trails Frida's interactive flexibility on exploratory work and on specific dynamic cases we have measured and lost. "Device-proven across API 28 to 36" is a claim about the agent attaching and hooks firing on every level, confirmed with an asymmetric field-write test, not a claim of total Java-surface parity. We would rather ship the precise statement.
Choosing the path in Rutken
You do not have to commit to a mechanism up front. Rutken exposes the in-house agent and the Frida path side by side in the Dynamic view, and the modified-runtime capture where it applies, and treats the choice as a dial rather than a fork in the road. For a cooperative app, attach and observe with whichever is convenient. For an app that kills Frida, switch to the in-house agent. For an app that scans for any foreign code, move to the modified runtime. The findings surface the same way regardless, and every observed call and network destination correlates back to the static analysis that predicted it, so you are comparing the app's intended behavior with its observed behavior, not just collecting a log.
Try the Frida-free path
If you have a target that detects Frida and dies, this is exactly the gap Rutken was built to fill, on apps you own or are authorized to test. Download Rutken and attach with the in-house path; the static analysis that maps the target is free and needs no device at all.
Frequently asked questions
What is the best Frida alternative for an app that detects Frida? An instrumentation path with no Frida artifacts: either an in-house hooking engine that does not link gum, or a modified runtime that injects nothing into the app at all. Both sidestep the memory-map, port, thread, and gum-structure signatures that anti-Frida checks scan for.
How exactly does an app detect Frida? Most commonly by reading /proc/self/maps for Frida-named regions, enumerating thread names under /proc/self/task, probing TCP 27042, and scanning for gum's in-memory structures. All of these key on something injected, which is why an artifact-free path defeats them.
Is this just another Frida wrapper? No. The in-house engine does its own prologue decoding, relocation with iced-x86's BlockEncoder, and five-byte jmp rel32 patching, with no dependency on gum. No gum means no gum fingerprint, which is the entire point.
Should I stop using Frida? No. Use it for fast interactive work on apps that do not detect it; it is the best tool for that. Switch to the artifact-free path only when the app fights back.
Does the alternative work on the newest Android? Yes. The in-house agent is device-proven across Android 9 through 16 (API 28 through 36), including a telemetry bug on Android 15/16 we root-caused and fixed.
Do I need root? No for observing a normal app you can repackage; the agent flips the app debuggable from inside its own process. The modified-runtime path runs in an isolated lab environment.