Scientist and worker dissecting an Android robot with a chainsaw
Art by pmjv_prahou. A gift to the last mage of the Open clan.

droidsaw takes a DEX file or a Hermes bundle apart and puts it back together byte-for-byte. For DEX, we ran that test against every file in F-Droid — 5,767 DEX files across 3,782 apps — and recovered each one bit-identically under preservation mode. For Hermes, we ran the same test on bytecode versions v84, v96, v98, and v99.

A roundtrip like this is the kind of test that fails loudly when the model of the format has a hole. If our model had a wrong rule anywhere — a string-table offset off by one, a missed alignment requirement, a padding byte we forgot to preserve — the re-emitted bytes would diverge from the input, and the test would say where. And it isn’t a one-off check: every parsed section is walked end-to-end and tiled into typed regions, so every byte ends up classified as a parsed Entry, an inter-entry Gap, or an UnparseableTail.

droidsaw is a decompiler and security-auditing suite for mobile apps. It walks an APK end to end — DEX, Hermes, native ELF, plus the manifest, signing, and resource surfaces — and cross- references the boundaries: a direct NativeModules.X.method() call through the React Native bridge resolves to its Java implementation as a single taint path, joined across the layers rather than reported on either side separately. (Production Metro bundles often emit the hoisted-closure shape instead; visitor coverage for that lands in v1.x.) It also runs on a standalone DEX or HBC file when an APK isn’t on hand.

Dart (Flutter), Unity IL2CPP, and iOS support are on the roadmap.

The workspace lints unwrap, expect, and panic as errors on every non-test module — no panics so far against the adversarial inputs we’ve come up with, though that’s the discipline floor, not a proof of absence. 96 Kani harnesses extend that floor with bounded-model-checked proofs on the arithmetic and decode properties the lints can’t cover, with independent oracles on the ones that warrant them (char::encode_utf8 for MUTF-8 codepoint decoding; u128 for the Hermes function_get u64 overflow).

Pure Rust. BSD-3-Clause.

What’s new here

Most Android RE tooling works per-layer: decompile the DEX, separately inspect the manifest, run YARA over the APK manually. The cross-layer questions — does this JS value reach Runtime.exec? does this Hermes bundle ship key material that the native layer never zeroes? — require stitching output from several tools by hand.

droidsaw’s contributions:

  1. Byte-exact Hermes reconstruction. Hermes is Meta’s JS engine for React Native — bytecode v40–v100, sparse public documentation. droidsaw disassembles Hermes bundles and reassembles them to bit-identical output, which implies complete coverage of the binary format: string table, bigint table, alignment, padding, and metadata layout. Every decompile output is additionally round-tripped through OXC; output that fails parse is annotated and returned, never silently dropped.

  2. Byte-exact DEX reconstruction. 100% byte-identical round-trip on F-Droid (3782 apps / 5767 DEX files) under preservation mode. 309 files differ in 24 header bytes only — exclusively non-canonical-SHA-1 inputs from the legacy dx toolchain (94% are DEX v035); droidsaw recomputes correct checksums on default emit, or preserves verbatim under audit mode. The cascade is typed-attributed via CanonicalTransform::InputChecksumNormalized. This is the correctness oracle: not a fixture comparison, not a class-count metric, but reconstruction fidelity on real APKs.

  3. Cross-layer taint across the React Native bridge. A JS NativeModules.X.method() call resolves to its @ReactMethod implementation in Java, and call flow follows from a JS event handler through the bridge to a native sink — represented as one TaintFinding, not three disconnected reports. 15 taint sources × 15 sinks defined in droidsaw-common, including bridge edges that span the layers. v1 ships the record type + stitcher infrastructure; today’s HBC visitor catches direct NativeModules.X.method() bridge calls but not the hoisted closure-captured shape that production Metro bundles emit — that visitor extension graduates in v1.x (see Shipped in v1.x).

  4. Completeness gauge on every parsed section. Variable-length data sections (debug_info, annotation_set, …) are walked end-to-end and tiled into typed regions — every byte is classified as a parsed Entry, an inter-entry Gap, or an UnparseableTail. Preserve-mode emit refuses with a typed error rather than silently filling gaps with zeros. The total-tiling claim is a build-time invariant, not a runtime hope.

  5. R8 outline-helper recogniser with family-prefix attestation rates measured. R8 emits structural helpers under namespace conventions (j$ for D8 library desugar, io.flutter for the Flutter Java bridge, h1 for horizontal-merge bridges, androidx for AAR-shipped libraries). The BlockOutlined recogniser fires on the structural shape; in mapping-less analysis the namespace prefix is the only attribution signal. Structural attestation rate = the share of classes in a family-prefix bucket whose internal shape matches the expected template (D8 desugar, Flutter bridge, etc.). Measured across the F-Droid corpus: j$, io.flutter, and h1 carry 0% structural attestation — the recogniser fires liberally on the prefix shapes, but F-Droid’s open-source apps rarely ship the exact R8 outline-class template at scale, so a class arbitrarily named under those prefixes gets suppressed from analyst tooling with no in-bucket fallback. androidx retains 1.93% via the inner-class $EnumUnboxingLocalUtility pattern that R8 preserves under minification. The structural recogniser ships in droidsaw-dex; attestation rates are not yet exposed in the runtime attestation path.

  6. Query your audit with SQL. Every audit invocation persists findings, credentials, taint flows, cross-layer composites, and string xrefs to a SQLite database with FTS5 full-text indexes and pre-canned views (actionable_findings, cross_layer_taint_critical, taint_critical, audit_summary, credentials, semgrep_hits, confidence_summary). No JSON-grep gymnastics: sqlite3 audit.db "SELECT * FROM actionable_findings WHERE cwe=78". The database is the API; the JSON envelope, the MCP server, and the bench harness all route through the same query layer. Re-runs of the same mode upsert by identity hash (no accumulating duplicates); cross-mode runs additively populate distinct rows.

Robustness

Adversarial inputs are the norm in malware analysis. The lint floor (described in the lead) is the broad discipline; what extends past it:

Architecture

Both decompilers follow the same pipeline:

decode → CFG → SSA (Braun) → optimize → Expr IR
       → structure → sugar → emit → validate

Deterministic IR — BTreeMap throughout, no HashMap. Typed opcode enum. Structural try-catch (partition before recurse). Zero-failures ratchet: SEMANTIC_FAIL stays at zero, COMPILE_FAIL decreases monotonically. Invariant tests at every stage boundary. Cross-validated against reference disassemblers. Production APKs tested alongside fixtures.

Formal backing

What it finds

Patterns droidsaw has surfaced on production apps:

A worked example on a stalkerware sample: Cerberus Anti-theft: a reverse engineering. Nine APKs analysed cross-version, 44 FCM commands documented; the hidden com.lsdroid.lsp companion added to Echap’s stalkerware-indicators — the IOC feed consumed by MVT, Quad9, AdGuard, TinyCheck, MISP — so consumers now see both halves of the LSP↔main IPC pair.

CVE-class detectors (APK signing + container):

Shipped in v1.x

v1 ships the infrastructure for these three; the analysis coverage lands post-tag in named follow-up streams.

Per-layer scope

LayerStatus
APK containerFull. Signing: v1–v3 verified (RSA-PSS / PKCS1v1_5 / ECDSA / DSA + v3 proof-of-rotation lineage walked under parent pubkey); v4 .idsig sidecar parsed and apk_digest cross-checked against v3 (Merkle-root + v4-signature verification graduates in v1.x). CVE-class detectors: Janus (CVE-2017-13156), Master Key II (AOSP bug 9695860, Bluebox 2013), v2/v3 rollback (CWE-347), block-size mismatch. Container surface: crypto, YARA (60 rules across credential / packer / crypto / anti-analysis), SDK inventory.
DEX → JavaReal decompiler. 100% byte-identical roundtrip on F-Droid (5,767 DEX files across 3,782 apps) under preservation mode; the 5.4% header-cascade subset is exclusively legacy-dx-toolchain non-canonical SHA-1, typed-attributed via InputChecksumNormalized. Zero-failures ratchet on fixture set.
Hermes → JSReal decompiler. Byte-exact reconstruction verified on bytecode versions v84, v96, v98, v99. OXC round-trip validated on decompile output.
Native ELFMetadata, hardening flags, JNI exports, relocation counts. No disassembly.

Capabilities

Read the code

Inspect the APK container

Audit

Interop

Repositories

All BSD-3-Clause.