Analyze Android Malware Without It Detecting You

Modern Android malware does not just hide, it watches for you. The moment it notices a debugger, a Frida gadget, or an emulator, a competent banker or dropper stops doing anything interesting: it sleeps, shows a benign login screen, or kills its own process. So dynamic analysis of a defended sample is a cat-and-mouse problem, and if your instrumentation has a tell, what you capture is a transcript of the malware pretending to be boring. This post is about the tells, about an approach that removes them, and about exactly where that approach still hits a wall. Everything measured below comes from this year's work on a live banker, not from a slide.

The sample is an analyst too

It helps to stop thinking of evasion as a passive shell and start thinking of the sample as an adversary running its own checks on you. A serious banker spends real effort deciding whether it is being watched before it does anything incriminating, because a single clean run inside an analyst's sandbox is how its command-and-control servers, its injection targets, and its exfiltration format end up in a report. From the malware author's side, the cheapest insurance is a handful of environment checks at startup. If any of them trip, the payload simply does not arm.

We have watched this happen from the inside. One live banker we studied this year, package com.ombththz.ufqsuqx, runs a startup battery that reads jdwp.enabled, fingerprints the system-on-chip with ro.soc.model (the emulator reports ranchu, the QEMU board name, which is a dead giveaway), pulls the device's ANDROID_ID, and probes a few crypto paths, all before it decides whether to behave. None of that is exotic. All of it defeats the standard toolchain, and we only know the exact list because we were observing the sample from a vantage point it could not see.

The three evasion families, and what each one defeats

In practice, anti-analysis on Android falls into three families, and they target three different instrumentation techniques by their fingerprints.

Anti-debugger. The app asks whether a debugger or JDWP connection is attached, or whether the process is running Java-debuggable. That last one matters more than it looks: to get a JVMTI environment on a production app that was never launched in debug mode, most instrumentation has to flip the app into a Java-debuggable state at runtime. That flip is a state change the app can read. Check android.os.Debug.isDebuggerConnected(), read the process's own debuggable flag, watch for a JDWP thread, and you have caught the most common attachment method in the act.

Anti-Frida. Frida injects a gadget into the target's address space, and that gadget is detectable. The sample scans its own /proc/self/maps for the gadget library and for frida-gum's structures, probes the default Frida server port, looks for named pipes and threads the gum engine creates, and in aggressive cases scans memory for gum's own string constants. These checks cost microseconds and they catch the single most popular dynamic-analysis tool outright. The banker above kills its own process roughly 0.66 seconds after Frida touches it. You attach, you blink, it is gone.

Anti-emulation. The sample decides it is on an emulator rather than a real phone and declines to run its real payload. The signals are build properties (ro.soc.model=ranchu, generic ro.product.* values, QEMU-shaped fingerprints), sensors that a real phone has and an emulator fakes poorly, timing and TLB behavior that differ under emulation, and the absence of a real Google Play Services footprint. Anti-emulation is a different kind of problem from the first two, and we will come back to why.

The unifying assumption behind all three is that your observer leaves a trace in the sample's world. The debugger is attached, the gadget is mapped, the emulator is generic. The counter is not a better way to hide a trace. It is an observer that leaves none.

Own the runtime instead of attaching to it

Every technique in the table below shares a weakness: it operates on the app's process, from inside the app's own address space or from an attached debugger the app can query. So every technique is, in principle, findable by something running in that same address space. The move that breaks the symmetry is to stop living in the app's world at all, and instead own the layer beneath it: the Android Runtime itself.

We built a modified version of ART, the runtime that executes every managed Android app, that observes the running app's call catalog from the inside, as part of the runtime, with no agent injected into the app and no debuggable flip for the app to notice. Concretely, this is a self-built libart packaged as a com.android.art APEX (around 47 MB) and deployed onto a controlled, rootable AOSP userdebug emulator image, where the ART APEX is updatable. The app launches on a runtime that is quietly reporting what it does, and from the app's point of view there is nothing to find: its /proc/self/maps contains no injected agent, no gadget, no JVMTI or JDWP artifacts, only the normal /apex/com.android.art/lib64/ entries that are supposed to be there. The process is not debuggable, because it never had to be.

Evasion family What it detects Own-the-runtime counter Status
Anti-debugger Attached debugger / JDWP, Java-debuggable flag No attach, no debuggable flip; observation lives in the runtime Defeated (device-proven)
Anti-Frida Gadget in maps, gum artifacts, server port Nothing injected into the app; zero agent map lines Defeated (device-proven)
Anti-emulation (behavioral) Build props, SoC name, sensors, timing Build-field spoof (v1.1), chips at the property checks Partial, open (active area)
Hardware attestation Play Integrity hardware-backed root of trust None; a software observer cannot forge hardware Not beaten (out of scope)

What 70 seconds of a stealthy run looks like

The point of removing the tell is not stealth for its own sake, it is the data you get once the sample stops hiding. The same banker that terminates 0.66 seconds after Frida contact ran for 70 seconds under the modified runtime, undetected, long enough to exercise and record its real behavior. "Undetected" is a measurement, not an adjective: there were zero injected-agent map lines in its address space during the run, and the process was never flipped debuggable.

From inside the runtime, the observation is not a single hook but the whole catalog. On our fixtures the modified libart fired 18 distinct catalog labels in one run, four crypto labels, two key-material labels, two TLS labels, file I/O, framework calls, three WebView labels, an anti-analysis label, class loading, and biometrics, across all five of our value-decode kinds (string, 32-bit int, boolean, class name, and the no-value case). The anti-analysis label is the one that lets you watch the malware look for you: that is how we enumerated the banker's own jdwp.enabled, ro.soc.model, ANDROID_ID, and crypto probes. You are not just evading the sample's checks, you are reading them.

Observing without becoming a leak yourself

A runtime that sees everything is also a runtime that could exfiltrate everything, including the key material of an app you are only meant to be analyzing. We treat that as a design constraint, not an afterthought. Key-material suppression is proven on-device: when the sample constructs a SecretKeySpec, the runtime emits the algorithm (for example AES) and not the key bytes; when it builds an IvParameterSpec from a byte array, the runtime records only that the constructor was called, not the IV contents. The observer's job is to tell you what the sample did, not to become a second copy of the sample's secrets.

Two tiers, because owning the runtime is not free

A modified runtime is the heavy option. It requires a controlled, rootable image and it does not boot everywhere, the updatable-ART-APEX mechanism it relies on exists on newer Android and not on older releases, which we are explicit about rather than pretending the heavy path is universal. Most samples do not need it. For a sample whose defenses are weaker or absent, an in-house agent, our own, not Frida, so it does not carry Frida's detectable artifacts, reaches the whole Android 9 to 16 span (API 28 through 36) and observes the app with a much lighter setup and no custom image.

Rutken treats the mechanism as an implementation detail of one goal: get the maximum information out of the sample without a detectable tell, and pick the cheapest tool that clears that bar for this target. An ordinary sample gets the in-house agent. A sample hardened specifically against attached instrumentation, the kind that kills Frida in under a second, is where the modified runtime earns its cost. You should not pay for owning the runtime when an agent the sample cannot see would have done the job.

The anti-emulation wall, and why it is a different problem

Here is the part most "undetectable malware analysis" claims skip, so we will put it in the middle rather than the footnotes. Owning the runtime defeats the anti-agent and anti-Frida families completely, those checks look for something in the app's address space, and there is nothing there. It does not, by itself, defeat anti-emulation, because anti-emulation is not asking about your observer. It is asking about the environment, and the environment really is an emulator.

We ship a first cut at this: a build-property spoof (v1.1) that overwrites android.os.Build's static string fields with real-device profile values from inside the runtime, so a sample reading Build.MODEL or Build.FINGERPRINT sees a plausible phone instead of a generic emulator. That chips at the cheapest behavioral checks. It does not win the category. A sample that cross-checks the SoC against the sensors, or times an operation that is slow under emulation, or notices that hardware-backed Google services are not really present, can still decide it is in a sandbox. Behavioral anti-emulation is an active, ongoing arms race, and we would rather tell you it is open than let you trust a run that the sample quietly declined to make interesting.

And one line further out is a wall we do not claim to climb at all: hardware-backed attestation. A sample that gates its payload on Play Integrity's hardware path is asking the device's secure element to vouch for it, and a software observer, however stealthy, does not forge a hardware root of trust. That is not a gap we are working to close with a cleverer spoof; it is a different problem, and pretending otherwise would be the exact kind of overclaim this whole post is written against. The good news for day-to-day analysis is that commodity banking and dropper malware overwhelmingly relies on the behavioral checks, not hardware attestation, precisely because it wants to run on the widest possible set of real devices.

Dynamic observation is strongest with a static map

Watching a sample run is far more useful when you already know what to watch for. Rutken's static analysis decompiles the sample, builds the call graph, and flags its suspicious capabilities, packed or dropped code, overlay abuse, SMS interception, accessibility and surveillance patterns, before you ever execute it. The runtime observation then confirms which of those capabilities actually fire and what they talk to, and each network destination is badged by how it was captured, so you always know whether a result came from the in-house agent or from the modified runtime. The end state is the sample's intended behavior (static) and its observed behavior (dynamic), correlated, rather than two disconnected piles of output.

A hard rule: isolated lab only

None of this changes the first rule of handling live malware. It runs in an isolated lab emulator, never on a daily-driver, never on a physical device you care about, never anywhere it can reach a network you are responsible for. Rutken's own workflow enforces that separation, and your process should too. Analyzing malware is authorized security work; running a live sample carelessly is how an analyst becomes the next incident.

Start with the static pass

You can triage a sample's capabilities statically, for free, with no device at all. Download Rutken, open the sample in an isolated environment, and read what it is built to do before you decide how, and whether, to watch it run.

Frequently asked questions

Can malware detect Rutken? The anti-agent and anti-Frida checks that trip up most tooling find nothing under the own-the-runtime approach, device-proven on a banker that kills Frida in under a second and then ran 70 seconds undetected. Behavioral anti-emulation and hardware attestation are separate problems we are explicit about, one partially addressed, one out of scope.

Why did the banker do nothing under Frida? It scanned its own process for Frida's artifacts, found the gadget, and self-terminated about 0.66 seconds after contact. A runtime with no injected agent gives it nothing to find.

How do you know it was not detecting you silently? Because we read its own anti-analysis checks from inside, jdwp.enabled, the ro.soc.model SoC fingerprint, ANDROID_ID, crypto, and watched them resolve to "not being watched." We were observing the detector.

Does the modified runtime leak the sample's secrets? No. Key-material suppression is proven on-device: algorithms are recorded, key bytes and IV contents are not.

Do I need the heavy runtime for every sample? No. Most samples are observed with the lighter in-house agent across Android 9 to 16; the modified runtime is reserved for samples hardened against attached instrumentation.

Is it safe to run malware this way? Only in an isolated lab emulator. Never on a physical device or anything you use for real.