Documentation

Go to Portal Website

Anti-Disassembly

PlanPlatformsMASVS
TeamAndroidMASVS-RESILIENCE-3

Overview

Anti-Disassembly injects specialized constructs into the compiled Android application that cause common reverse-engineering tools to fail, crash, or produce corrupted output when attempting to decompile the protected APK. This control significantly increases the difficulty and time required for attackers to analyze the application's code, protecting proprietary algorithms, business logic, and security mechanisms from rapid inspection.

The injected constructs are carefully designed to confuse decompilation tools while remaining completely benign at runtime. None of the anti-disassembly traps affect application behavior, performance, or compatibility — trap classes are never referenced by the app, and all modifications produce valid DEX bytecode that the Android Runtime (ART) processes normally.

This control is essential for applications containing valuable intellectual property, custom security implementations, or sensitive business logic that must be protected from automated reverse-engineering workflows.

How It Works

Anti-Disassembly operates during the Android build pipeline after the APK has been decompiled to smali bytecode but before it is reassembled. The control injects eight categories of trap constructs that exploit limitations and edge cases in popular decompilation tools:

Decompiler Confusion Techniques

The control injects synthetic smali classes into randomly-named packages that contain constructs specifically designed to trigger failures in decompilation tools:

  1. Deeply Nested Structures — Creates annotation hierarchies and control-flow patterns with extreme nesting depths that overflow recursive parsers or exceed tool-specific limits, causing stack overflows or out-of-memory errors during disassembly.
  1. Extreme Data Payloads — Generates methods with very large inline data sections (16 KB+ arrays, 32 KB+ string constants) that cause offset miscalculations in tools that assume typical payload sizes, producing unassemblable output with incorrect branch targets or label references.
  1. Overlapping Control Flow — Creates methods with dozens of interleaved exception handlers whose protected ranges cross each other in valid but complex ways that confuse control-flow reconstruction algorithms, causing tools to error out or produce invalid code.
  1. Edge-Case Constants — Uses extreme numeric values (e.g., Integer.MIN_VALUE, full 32-bit range spans) in switch statements that trigger arithmetic overflow in tools performing label offset calculations, resulting in corrupted jump tables.
  1. Multi-DEX Trap Distribution — Injects trap classes into multiple DEX files when the APK uses multi-dex packaging, ensuring decompiler failures occur across all DEX components rather than only in the primary classes.dex.
  1. File System Conflicts — On case-insensitive file systems (Windows, macOS default), creates resource entries whose names differ only in letter case, causing silent overwrites during decompilation that corrupt the extracted project structure.
  1. Opaque Dead Code — Injects methods containing unreachable instruction sequences after unconditional branches, producing valid DEX bytecode that causes basic-block analysis failures in tools attempting to reconstruct clean control flow.
  1. Format Edge Cases — Exploits corner cases in DEX format specifications (e.g., jumbo string instructions, wide array data, extreme annotation nesting) that are valid according to the DEX spec but rarely encountered in practice, exposing latent bugs in decompilation tool parsers.

Tools Affected

This control has been tested against and successfully disrupts the following popular reverse-engineering tools:

Runtime Behavior

Trap classes are never instantiated or referenced by the application at runtime. The Android Runtime (ART) loads and verifies only the classes that are actually used by the application. The anti-disassembly traps exist solely in the APK structure to confuse static analysis tools — they are ignored during normal execution.

All injected constructs produce valid DEX bytecode according to the Android specification. The traps do not violate Android's bytecode verifier rules, dex format constraints, or runtime expectations. The APK passes Google Play verification and installs normally on all Android devices.

Threats Mitigated

Use Cases

Caveats

Legitimate Analysis Tools Affected

Anti-Disassembly disrupts all decompilation tools that analyze the APK structure, including those used for legitimate purposes:

Not a Complete Protection

Anti-Disassembly significantly raises the difficulty of reverse engineering but does not make it impossible:

APK Size Increase

The injected trap constructs add approximately 200-500 KB to the APK size, depending on the number of DEX files and the distribution of traps. This increase is negligible for most applications but may be a consideration for size-sensitive deployments.

Support Matrix

PlatformSupportedVersionNotes
Android✅ YesAllApplied during APK build pipeline
iOS❌ NoN/ANot applicable (different binary format)

How to Enable the Control

Navigate to Code Obfuscation from the AppTego portal, and expand the Control Flow Obfuscation section. Under this section you will find the Anti-Disassembly control. Click Enable to apply it to the next protected build.

API Configuration Example

Anti-Disassembly is a binary control with no configuration options. Include it in the controls array to enable:

{
  "controls": [
    {
      "title": "Anti-Disassembly",
      "value": "AntiDisassembly",
      "type": "binary"
    }
  ]
}

When enabled, the control automatically injects all trap categories during the Android build process. No additional configuration or integration is required.