How Android Root Detection Actually Works
What 'rooted' really means, the signals apps look for, why local checks alone are never enough, and how to layer detection with server-side attestation.
- #root detection
- #android security
- #play integrity
- #magisk
Table of contents
Root detection is one of the first controls security teams ask for — and one of the most misunderstood. It is not a single check. It is a set of signals, each with blind spots, that together tell you how much to trust the environment your app is running in.
What “rooted” actually means
Android's security model rests on the application sandbox: each app runs as its own Linux user, and the kernel keeps apps from reading each other's data. Root means a process can run as UID 0 and step outside that model — read any app's private storage, inject into other processes, or modify the system.
Modern root solutions are systemless: instead of modifying the /system partition, they mount changes at boot. That makes them harder to spot and easy to hide from individual apps.
The classic local signals
Most root checks fall into a handful of families:
| Signal | What it looks for | Weakness |
|---|---|---|
| Binaries | su in common paths | Trivially renamed or hidden |
| Build properties | test-keys, ro.debuggable=1 | Only catches custom builds |
| Packages | Known root-manager apps | Randomised package names |
| Mounts | Writable system partitions | Systemless root avoids it |
| SELinux | Permissive mode | Most rooted devices stay enforcing |
A minimal Kotlin example of the first two families:
object RootSignals {
private val suPaths = listOf(
"/system/bin/su", "/system/xbin/su", "/sbin/su",
"/vendor/bin/su", "/data/local/xbin/su",
)
fun hasSuBinary(): Boolean = suPaths.any { File(it).exists() }
fun hasTestKeys(): Boolean =
Build.TAGS?.contains("test-keys") == true
fun collect(): Map<String, Boolean> = mapOf(
"su_binary" to hasSuBinary(),
"test_keys" to hasTestKeys(),
)
}Why local checks are never enough
Root-hiding tools are designed to answer each question an app asks with the "clean" answer. If your detection only runs in managed Kotlin/Java code, a hooking framework can simply replace hasSuBinary() so it always returns false.
That's why robust implementations:
- Layer many independent signals so that hiding all of them consistently is costly.
- Move critical checks into native code, where hooking is harder (but not impossible).
- Re-check during the session instead of only at launch.
- Verify on the server, where the attacker has no control.
Add server-side attestation
The Play Integrity API returns a signed verdict about the device and app that your backend verifies. The client never decides; it just forwards a token.
Rendering diagram…
Decide what to do with the result
Blocking every rooted device outright generates support tickets and punishes enthusiasts. A better approach is risk-based:
- Low-risk screens: log the signal, continue.
- Sensitive actions (payments, credential changes): require step-up authentication.
- Strong evidence of active tampering: block and report.
Key takeaways
- Root detection is signal collection, not a yes/no function.
- Local checks are bypassable by design; layer them and move critical ones native.
- Pair client signals with server-verified attestation.
- Respond with policy, not panic.