Decompiling Hermes bytecode with hermes-decomp
/ 2 min read / #reverse #rust #react-native #mobile
A fuller version of this research is on the Symbiotic Security blog, with the complete technical paper available as a PDF.
Modern React Native apps no longer ship their JavaScript in clear text. The bundle is compiled to Hermes bytecode (.hbc). For anyone auditing a mobile app, that is a wall. hermes-decomp exists to knock it down.
The problem
Hermes is the default JS engine for React Native. At build time the JS bundle is compiled to bytecode, and every Hermes release changes the format. Existing tools stop at disassembly, so most audits stall there, staring at raw opcodes instead of code. The source that implemented authentication, key handling or a license check is simply not present anymore.
hermes-decomp supports HBC 40 through 99 and produces readable JavaScript.
How it works
The decompiler is deterministic, which means the same bytecode always yields the same output a reviewer can audit, with no model guessing in the loop. It runs a five-stage pipeline:
- Parsing extracts the headers, string tables and instructions from the binary.
- Disassembly turns raw bytes into readable operations.
- IR generation lifts the bytecode into a higher-level intermediate representation with control-flow graphs.
- Analysis and transformation applies optimization and pattern matching to recover structure such as classes and async functions.
- Code generation emits valid JavaScript.
To trust the output we validated it against a public corpus of 359 programs, every one passing a round-trip test that recompiles and re-runs the decompiled code. We also stress-tested it live on the CTF challenges at Insomni'hack, where it solved real mobile reversing tasks.
Getting the bundle
Inside an APK the bundle usually lives here:
unzip app.apk 'assets/index.android.bundle' -d out/
file out/assets/index.android.bundle
Usage
hermes-decomp info app.hbc
hermes-decomp disasm app.hbc --function 5 --info --show-offsets
hermes-decomp decompile app.hbc -o out.js
hermes-decomp decompile app.hbc --deep -o out.js # recovers more names, slower
hermes-decomp xref app.hbc --query "loginWithToken"
hermes-decomp tui app.hbc
xref is often the best entry point. Search for an interesting string, an endpoint, an auth function name or an API key, then walk back to the code that uses it.
With an LLM
The project also ships hermes-mcp, an MCP server. An agent can query the bytecode directly, listing functions, decompiling and searching xrefs, instead of drowning in a 200,000-line file.
Installation
Prebuilt binaries for Linux, macOS and Windows are on the releases page, or build from source:
git clone https://github.com/SymbioticSec/hermes-decomp.git
cd hermes-decomp && cargo build --release