Decompilation Leaves Only Two Classes: A Self-Built Android Shell's Engineering Retrospective
Componentized Android apps can now hide all business code from static decompilers without commercial hardening, but only if they replicate the same three solutions: a three-path ClassLoader swap with verification, FileLock-based multi-process decryption, and ARouter cache prewriting. The approach deliberately sets the bar at forcing an attacker into dynamic debugging, not blocking professional reverse engineers.
The post presents a whole-payload encryption approach for Android hardening, contrasting it with method-body stripping (dpt-shell). It details how the APK retains only two shell classes (an Application stub and an AppComponentFactory), a stripped native library, and encrypted payloads for DEX, SO, and H5. The encryption is a simple XOR stream, designed to hide business code from static decompilers, not to resist skilled reverse engineers.
The startup pipeline runs seven steps: attachBaseContext, signature and integrity checks, native decryption to private storage with FileLock, ClassLoader replacement with three reflection paths plus an official AppComponentFactory fallback, ARouter cache prewiring, and reflective creation of the real Application. Key decisions include avoiding method stripping to preserve runtime DEX scanning for ARouter, using a marker file and atomic rename for multi-process decryption, and generating integrity checks before the APK is finalized.
Validation used an adversarial matrix: modified signatures, resource tampering, Frida/injection detection (TracerPid, maps, ports), and static decompilation. Three-process cold starts on Android 10 and 16 showed zero crashes, with a benign hidden API warning on Android 16. The author also distinguishes real security findings from false positives from third-party scanners, and refuses to impersonate commercial shell vendors for compliance. The boundaries are explicit: root can dump decrypted payloads, and the shell is not commercial-grade (no VMP, no strong anti-debug).
Method-body stripping is often perceived as stronger hardening, but it breaks any framework that reflectively scans DEX at runtime. The article's decision to use whole encryption treats the existing engineering architecture as a non-negotiable constraint, which is a pragmatic and often overlooked priority.
The design degrades to plaintext execution if all fallback paths fail, a deliberate trade-off to keep the app alive. That philosophy makes sense for a self-built shell but means the protection is only as good as the fallback reliability.
The ARouter cache issue is a classic example of a tool caching a result obtained too early in the boot chain. Any hardening approach that delays the real DEX must either prevent an early scan or pre-warm the cache; this is a general lesson beyond Android.
The article's explicit refusal to fake commercial shell markers for compliance is a notable integrity boundary, especially in a field where passing third-party security scans often becomes the primary goal.
Can REA crack it?
Good question. REA is a scout, not a lockpicker—officially it doesn't do automated unpacking; after packing, it only sees the 2 shell classes. Frida dynamic instrumentation gets blocked by anti-injection detection. Dumping under root is theoretically still possible; that's the boundary of this practical shell, as made clear in section 7. It can stop automated dismantling, but against professional reverse engineering you'd still need commercial hardening.