--- name: android-root-antidebug-bypass description: Bypass Android root/emulator/debugger/Frida detection and anti-tamper — objection/Frida CodeShare hooks, Magisk DenyList/Zygisk/Shamiko hiding, and smali patching of isRooted/anti-debug checks. Tier 1. Use when an app refuses to run on a rooted/instrumented device. Aligns to OWASP MASTG MASVS-RESILIENCE. --- # Android Root / Anti-Debug / Anti-Tamper Bypass Defeat the controls that stop your test device from running the app so dynamic testing can proceed — and demonstrate the controls are insufficient. ## Trigger phrases `root detection, root bypass, anti-debug, anti-tamper, frida detection, emulator detection, magisk denylist, zygisk, shamiko, fridantiroot, tracerpid` ## Method 1. **Identify the checks** — in jadx/strings look for `su`, `magisk`, `/system/xbin`, `busybox`, `frida`, `re.frida`, port `27042`, `TracerPid`, `ro.kernel.qemu`, build fingerprints, `Debug.isDebuggerConnected`, `RootBeer`. 2. **Runtime hook (fastest):** - `objection -g explore` → `android root disable` - `frida --codeshare dzonerzy/fridantiroot -U -f ` 3. **Hide root with Magisk:** add the target package to **DenyList** + enable **Zygisk** + **Shamiko**; use a device without `su` in PATH where possible. 4. **Smali patch (persistent):** in jadx find `isRooted()`/`isDebuggable()`/`isEmulator()`; edit smali to return `false`/`0`, then: - `apktool b app_src -o patched.apk && java -jar uber-apk-signer.jar -a patched.apk --allowResign` 5. **Beat early/anti-Frida checks** with spawn-gating: `frida -U -f --no-pause` and inject before the check runs. ## Modern / rare techniques - **[RARE] Native detection in `.so`** — root/Frida checks moved to native; hook the specific export or patch the branch (chain `android-native-lib-analysis`). - **Frida-specific detection** (named pipes `/data/local/tmp/re.frida`, maps scan, thread names, port 27042) — hook the detection function or use a renamed/stealth frida-server. - **Emulator fingerprints** (`ro.kernel.qemu`, `generic` build props) — spoof props or use a hardened AVD / physical rooted device. ## Bypass / evasion Layered apps combine root + Frida + pinning detection — apply anti-root/anti-Frida hooks first, then `android-ssl-pinning-bypass` and `android-frida-objection-instrumentation`; prefer smali patch when runtime hooks are themselves detected. ## Escalation / chaining Unblocks ALL dynamic testing — `android-frida-objection-instrumentation`, `android-ssl-pinning-bypass`, `android-biometric-bypass`, `android-insecure-storage` (runtime). The bypass itself evidences weak resilience controls. ## Backend & tooling Preferred Kali path (native Kali / WSL+Kali / Kali-SSH / Kali-MCP / HexStrike). Needs the user's rooted device/emulator (Magisk + Zygisk/Shamiko; frida-server) + Kali tooling (objection/Frida/apktool/uber-apk-signer). Windows-local last resort. See `zazy-orchestrator`. ## Verification (background, before reporting) Confirm the app that previously refused/crashed now runs and stays running on the rooted/instrumented device across a restart before concluding the control is bypassed. Re-run independently. ## Evidence The detection logic found, the bypass applied (hook/Magisk/smali), and the app running normally under instrumentation. Remediation: layered detection + integrity + Play Integrity/attestation; never rely on client checks alone.