37 — Root Detection · References
Annotated. Each entry says why you would open it, so you can pick the right one under time pressure.
Primary source — AOSP
Read these on cs.android.com , which gives cross-references and history. See
07-AOSP for navigation technique.
The filesystem path — where File.exists() really goes
Path
Open it when
libcore/ojluni/src/main/java/java/io/File.java
You need to see that exists() delegates to UnixFileSystem, not to a syscall directly
libcore/ojluni/src/main/java/java/io/UnixFileSystem.java
You are tracing getBooleanAttributes down to Libcore.os
libcore/luni/src/main/java/libcore/io/Posix.java
The bottom of the Java filesystem stack; every Java FS API funnels here
libcore/luni/src/main/java/libcore/io/BlockGuardOs.java
The wrapper an app actually holds. Hook this class, not Posix, when you want to catch every Java filesystem API at once
libcore/luni/src/main/native/libcore_io_Posix.cpp
The exact point where Java filesystem calls become native calls — the boundary a Java hook cannot see past
bionic/libc/bionic/
access, stat, openat wrappers; confirms which syscall your architecture actually issues
The property system
Path
Open it when
bionic/libc/bionic/system_property_get.cpp
You are hooking __system_property_get and your spoof does nothing — check whether the caller uses __system_property_find + read_callback instead
bionic/libc/include/sys/system_properties.h
You need PROP_VALUE_MAX and the exact reader API surface
system/core/init/property_service.cpp
You want the writer side, and which properties init refuses to change
system/core/init/
How ro.boot.* properties arrive from the kernel command line — the provenance argument for verifiedbootstate
frameworks/base/core/jni/android_os_SystemProperties.cpp
The bridge between android.os.SystemProperties and bionic
Packages and process execution
Path
Open it when
frameworks/base/core/java/android/app/ApplicationPackageManager.java
The concrete PackageManager an app receives. The class to hook
frameworks/base/services/core/java/com/android/server/pm/AppsFilter.java
Package visibility filtering — why an API 30+ check silently returns "not installed"
frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
The system_server side of the Binder call
libcore/ojluni/src/main/java/java/lang/ProcessBuilder.java, ProcessImpl.java
The Runtime.exec → fork/execve path
Security state
Path
Open it when
external/selinux/libselinux/src/getenforce.c
You are reading a native SELinux state check and want the exact sysfs node
system/security/keystore2/
Key attestation implementation, for the hardware-backed half of §3.15
external/avb/
Android Verified Boot — where verifiedbootstate actually comes from
Official documentation
OWASP
Resource
Relevance
MASVS
The standard your client's requirements are probably derived from
MASVS-RESILIENCE
The category root detection sits in.MASVS itself frames these as resilience , not security controls — that framing is the whole argument of this chapter
MASTG
Test procedures
MASTG Android tests
The platform-integrity and anti-reversing tests map onto §3
MASTG UnCrackable series
Canonical practice targets — see 80-Appendix
Tool
Where
Use
Magisk
device
The root implementation you will actually meet
Magisk DenyList
device
Step 1 of the bypass ladder — read this before writing any hook
Zygisk
device
Zygote injection; also the module API, if you want to understand hiding modules
RootBeer
source
Read the source. It is the library you will meet most often and it documents its own limitations honestly
Frida
host + device
Everything in §7
Frida JavaScript API
docs
Interceptor, Module, Memory.patchCode, Java.perform
Objection
host
android root disable as a thirty-second probe
jadx
host
Decompilation; string search is the highest-yield triage step
apktool
host
Smali-level patching and manifest inspection
Ghidra
host
Native checks. Start with Imports and Java_* Exports
radare2
host
Faster than Ghidra for "which function references this string"
strace (toybox / NDK build)
device root
Ground truth. The only tool a hook cannot lie to
MobSF
host
Lead generation, not findings. Verify every hit dynamically
Standards and regulatory context
Useful when a client asks "why do we have to do this at all", which is a question about compliance
rather than security.
Security research
Resource
Why
Android Security Bulletins
The authoritative record. Read for the pattern of which subsystems recur, not to memorise identifiers
Google Project Zero
The highest-quality public work on Android privilege escalation — the mechanisms that make rooting possible in the first place
Android VRP rules
What Google considers reportable, and the severity model
OWASP MAS research
The community's accumulated position on resilience controls
Note on CVE citation. This chapter deliberately describes vulnerability classes rather than
naming identifiers. Privilege-escalation and attestation-bypass bugs are numerous, version-specific,
and frequently mis-cited in blog posts; a misattributed CVE in a client report is worse than no
citation at all. When you need a specific reference, pull it from the bulletin for the affected
release rather than from memory.
Search for the topic rather than a URL, since hosting moves.
Mobile banking app security assessments — OWASP AppSec and local OWASP chapter tracks
Magisk internals and the hiding arms race — talks by the Magisk maintainer and the module community
Attestation and hardware roots of trust — USENIX Security, Black Hat mobile tracks
Frida internals and the Java bridge — the maintainers' own talks are the best source
Anti-fraud on mobile at scale — fintech engineering blogs, which are more honest about the economics
than security vendors are
Work
Why
Android Security Internals — Nikolay Elenkov
Best structural account of the security model root breaks; dated in specifics, still the right mental model
Android Internals: A Confectioner's Cookbook — Jonathan Levin
Deepest published treatment of the low-level boot and init path that root modifies
The Mobile Application Hacker's Handbook
Dated, but the assessment methodology chapters hold up