Prerequisites
- Target system, dependencies and environment configured.
Usage
Purpose
Mobile apps run on devices attackers control, so some apps add defences against reverse engineering and tampering — root/jailbreak detection, code obfuscation, anti-debugging, integrity checks. These raise the cost of analysis and attack, but they're not absolute (an attacker with device control can bypass them, as an assessor does). This skill covers both sides: assessing these protections (and bypassing them in an authorised test) and implementing them with realistic expectations of what they achieve.
When to use it
Assessing an app that has these protections (you'll need to bypass them to continue testing), or advising on implementing them. The crucial framing: these are defense-in-depth that raises cost, not controls that make an app unbreakable — understanding that limit is the point.
The protections (and what each achieves)
- Root/jailbreak detection — detects a compromised device and refuses to run (or limits functionality). Raises the bar (many attackers use rooted devices), but is bypassable by hooking the detection.
- Code obfuscation — makes the decompiled code harder to read (renamed symbols, control-flow obfuscation, string encryption). Slows analysis; doesn't prevent it.
- Anti-debugging / anti-instrumentation — detects and blocks debuggers and Frida. Raises the cost of dynamic analysis; bypassable.
- Integrity/tamper checks — the app verifies it hasn't been modified/repackaged (checksum, signature verification). Detects repackaging; bypassable by patching the check.
- Emulator detection — refuses to run on emulators (analysis environments).
Procedure (assessing / bypassing, authorised)
- Identify the protections present. Static analysis and running the app reveal them — the app refusing to run on a rooted device (root detection), unreadable decompiled code (obfuscation), Frida being blocked (anti-instrumentation), the app detecting modification (integrity checks).
- Bypass to continue the assessment. These protections block your testing, so an authorised assessment bypasses them — typically by hooking the detection functions with Frida to return "clean" (root detection → not rooted, integrity → valid, debugger → none). This is the same technique as pinning bypass:
// hook the root-detection method to always return false ; same for integrity/debugger checks
objection -g <pkg> explore # includes root-detection bypass helpers
- Assess the robustness for the report. Note whether the protections are trivially bypassable (a single check, easily hooked) or robust (multiple layers, native checks, integrity verification of the checks themselves). This informs the defensive recommendation.
- Recognise obfuscation slows, not stops. Obfuscated code takes longer to analyse but is ultimately readable; don't treat obfuscation as a security control against a determined analyst.
Implementing them (the defensive side)
- Use them as defense-in-depth, with realistic expectations. These protections raise the cost and deter casual attackers, which is worthwhile — but a determined attacker with device control bypasses them. Never rely on them as the only protection for something critical; the server must not trust the client.
- Layer and harden them if the threat model warrants — multiple root-detection methods, native (not just Java) checks, integrity verification, anti-instrumentation — since single checks are trivially bypassed. Robustness comes from layering and making the checks themselves tamper-resistant.
- Don't put security-critical logic client-side trusting these protections. The key defensive principle: client-side controls (including these) can be bypassed, so security-critical decisions (authentication, authorization, sensitive logic) must be enforced server-side, not protected only by anti-tampering.
Cheatsheet
apps run on devices attackers CONTROL -> some add anti-RE/tamper defences
raise COST + deter, but NOT absolute (device-control attacker bypasses, as an assessor does)
protections (what each achieves)
root/JB detection refuse on compromised device — raises bar, bypassable (hook detection)
obfuscation harder-to-read decompile — SLOWS analysis, doesn't stop it
anti-debug/anti-Frida detects+blocks dynamic analysis — raises cost, bypassable
integrity/tamper verify not modified/repackaged — detects repackaging, bypassable (patch check)
emulator detection refuse on emulators
assess/bypass (authorised): identify -> hook detection to return "clean"
(root->false, integrity->valid, debugger->none) ; objection has helpers ; note robustness
implement (defensive): DEFENSE-IN-DEPTH w/ realistic expectations
raise cost + deter casual attackers (worthwhile) BUT not the only protection
LAYER + harden (multiple methods, NATIVE checks, integrity of the checks) — single check = trivial bypass
KEY: never trust the client. security-critical logic (auth/authz) = SERVER-SIDE, not anti-tamper
Reading the protections
- A single, easily-hooked root-detection check = trivially bypassable; it deters casual attackers but stops no determined one. Note it as weak in the report.
- Layered, native, integrity-verified protections = robust; raises the cost substantially, though still not absolute against a determined attacker. The realistic goal.
- Obfuscated code = slows analysis but is readable with effort; don't treat it as preventing reverse engineering, only raising its cost.
- The app relying on client-side protections for security-critical decisions = a finding; these are bypassable, so authentication/authorization/sensitive logic must be server-side. Client-side controls trusting anti-tampering is the core mistake.
- Anti-instrumentation blocking Frida = present; you'll bypass it to continue testing, and it indicates the app takes hardening seriously (but is still bypassable).
- Protections as defense-in-depth atop server-side security = the correct posture; they raise cost while the real security is server-side.
Pitfalls
- Treating these protections as absolute. They raise cost and deter casual attackers but are bypassable by anyone with device control (as an assessor demonstrates). Don't rely on them as the only protection.
- Putting security-critical logic client-side trusting anti-tampering. The key mistake — client-side controls are bypassable, so auth/authz/sensitive logic must be server-side. Anti-tampering protects the client, not the decision.
- Single-check protections. One root-detection method or integrity check is trivially hooked; robustness needs layering, native checks, and integrity of the checks themselves.
- Treating obfuscation as security. It slows analysis; it doesn't prevent it. Don't rely on it to hide secrets or logic.
- For assessors: not bypassing them to test. These protections block assessment; an authorised test bypasses them to reach the app's real behaviour, exactly as an attacker would.
References
- OWASP MASTG (resilience/anti-tampering testing) and MASVS (resilience requirements)
- Frida, Objection root-detection/anti-tampering bypass documentation
- The ssl-pinning-bypass and dynamic-instrumentation-frida skills
- OWASP mobile anti-reversing guidance (and its stated limits)
Inputs
- Relevant source code, logs, network traces, or system specifications.
Outputs
- Analysis findings, security audit report, or generated code artifacts.
1---2name: reverse-engineering-protections3description: Use when assessing or implementing a mobile app's anti-reversing defences — root/jailbreak detection, obfuscation, and anti-tampering — understanding what they achieve and their limits.4---5678## Prerequisites9- Target system, dependencies and environment configured.1011## Usage12### Purpose1314Mobile apps run on devices attackers control, so some apps add defences against reverse engineering and tampering — root/jailbreak detection, code obfuscation, anti-debugging, integrity checks. These raise the cost of analysis and attack, but they're not absolute (an attacker with device control can bypass them, as an assessor does). This skill covers both sides: assessing these protections (and bypassing them in an authorised test) and implementing them with realistic expectations of what they achieve.1516### When to use it1718Assessing an app that has these protections (you'll need to bypass them to continue testing), or advising on implementing them. The crucial framing: these are *defense-in-depth that raises cost*, not controls that make an app unbreakable — understanding that limit is the point.1920### The protections (and what each achieves)2122- **Root/jailbreak detection** — detects a compromised device and refuses to run (or limits functionality). Raises the bar (many attackers use rooted devices), but is bypassable by hooking the detection.23- **Code obfuscation** — makes the decompiled code harder to read (renamed symbols, control-flow obfuscation, string encryption). Slows analysis; doesn't prevent it.24- **Anti-debugging / anti-instrumentation** — detects and blocks debuggers and Frida. Raises the cost of dynamic analysis; bypassable.25- **Integrity/tamper checks** — the app verifies it hasn't been modified/repackaged (checksum, signature verification). Detects repackaging; bypassable by patching the check.26- **Emulator detection** — refuses to run on emulators (analysis environments).2728### Procedure (assessing / bypassing, authorised)29301. **Identify the protections present.** Static analysis and running the app reveal them — the app refusing to run on a rooted device (root detection), unreadable decompiled code (obfuscation), Frida being blocked (anti-instrumentation), the app detecting modification (integrity checks).312. **Bypass to continue the assessment.** These protections block your testing, so an authorised assessment bypasses them — typically by hooking the detection functions with Frida to return "clean" (root detection → not rooted, integrity → valid, debugger → none). This is the same technique as pinning bypass:32 ```33 // hook the root-detection method to always return false ; same for integrity/debugger checks34 objection -g <pkg> explore # includes root-detection bypass helpers35 ```363. **Assess the robustness for the report.** Note whether the protections are trivially bypassable (a single check, easily hooked) or robust (multiple layers, native checks, integrity verification of the checks themselves). This informs the defensive recommendation.374. **Recognise obfuscation slows, not stops.** Obfuscated code takes longer to analyse but is ultimately readable; don't treat obfuscation as a security control against a determined analyst.3839### Implementing them (the defensive side)40415. **Use them as defense-in-depth, with realistic expectations.** These protections raise the cost and deter casual attackers, which is worthwhile — but a determined attacker with device control bypasses them. Never rely on them as the *only* protection for something critical; the server must not trust the client.426. **Layer and harden them** if the threat model warrants — multiple root-detection methods, native (not just Java) checks, integrity verification, anti-instrumentation — since single checks are trivially bypassed. Robustness comes from layering and making the checks themselves tamper-resistant.437. **Don't put security-critical logic client-side trusting these protections.** The key defensive principle: client-side controls (including these) can be bypassed, so security-critical decisions (authentication, authorization, sensitive logic) must be enforced server-side, not protected only by anti-tampering.4445### Cheatsheet4647```48apps run on devices attackers CONTROL -> some add anti-RE/tamper defences49 raise COST + deter, but NOT absolute (device-control attacker bypasses, as an assessor does)5051protections (what each achieves)52 root/JB detection refuse on compromised device — raises bar, bypassable (hook detection)53 obfuscation harder-to-read decompile — SLOWS analysis, doesn't stop it54 anti-debug/anti-Frida detects+blocks dynamic analysis — raises cost, bypassable55 integrity/tamper verify not modified/repackaged — detects repackaging, bypassable (patch check)56 emulator detection refuse on emulators5758assess/bypass (authorised): identify -> hook detection to return "clean"59 (root->false, integrity->valid, debugger->none) ; objection has helpers ; note robustness6061implement (defensive): DEFENSE-IN-DEPTH w/ realistic expectations62 raise cost + deter casual attackers (worthwhile) BUT not the only protection63 LAYER + harden (multiple methods, NATIVE checks, integrity of the checks) — single check = trivial bypass64 KEY: never trust the client. security-critical logic (auth/authz) = SERVER-SIDE, not anti-tamper65```6667### Reading the protections6869- **A single, easily-hooked root-detection check** = trivially bypassable; it deters casual attackers but stops no determined one. Note it as weak in the report.70- **Layered, native, integrity-verified protections** = robust; raises the cost substantially, though still not absolute against a determined attacker. The realistic goal.71- **Obfuscated code** = slows analysis but is readable with effort; don't treat it as preventing reverse engineering, only raising its cost.72- **The app relying on client-side protections for security-critical decisions** = a finding; these are bypassable, so authentication/authorization/sensitive logic must be server-side. Client-side controls trusting anti-tampering is the core mistake.73- **Anti-instrumentation blocking Frida** = present; you'll bypass it to continue testing, and it indicates the app takes hardening seriously (but is still bypassable).74- **Protections as defense-in-depth atop server-side security** = the correct posture; they raise cost while the real security is server-side.7576### Pitfalls7778- **Treating these protections as absolute.** They raise cost and deter casual attackers but are bypassable by anyone with device control (as an assessor demonstrates). Don't rely on them as the only protection.79- **Putting security-critical logic client-side trusting anti-tampering.** The key mistake — client-side controls are bypassable, so auth/authz/sensitive logic must be server-side. Anti-tampering protects the client, not the decision.80- **Single-check protections.** One root-detection method or integrity check is trivially hooked; robustness needs layering, native checks, and integrity of the checks themselves.81- **Treating obfuscation as security.** It slows analysis; it doesn't prevent it. Don't rely on it to hide secrets or logic.82- **For assessors: not bypassing them to test.** These protections block assessment; an authorised test bypasses them to reach the app's real behaviour, exactly as an attacker would.8384### References8586- OWASP MASTG (resilience/anti-tampering testing) and MASVS (resilience requirements)87- Frida, Objection root-detection/anti-tampering bypass documentation88- The ssl-pinning-bypass and dynamic-instrumentation-frida skills89- OWASP mobile anti-reversing guidance (and its stated limits)9091## Inputs92- Relevant source code, logs, network traces, or system specifications.9394## Outputs95- Analysis findings, security audit report, or generated code artifacts.