Decompile a Hermes React Native Binary

  1. Pull APK from device

adb shell pm list packages | grep <app_name>
adb shell pm path <package_name>
adb pull /data/app/<package_name>-<random>/base.apk .
  1. Decompile APK resources

    apktool d base.apk -o output_folder
  2. Locate React Native bundle

    cd output_folder/assets/
    ls
  3. Check if Hermes bytecode

    file index.android.bundle
  4. Get Hermes decompiler

    git clone https://github.com/cognisys/hermes-dec.git
    cd hermes-dec
    pip3 install -r requirements.txt
  5. Disassemble Hermes bytecode

    python3 hbc_disassembler.py ../index.android.bundle disasm_out
  6. Decompile to JavaScript

    python3 hbc_decompiler.py ../index.android.bundle decompiled_out
  7. (Optional) Beautify/Deobfuscate JS

    npx prettier --write decompiled_out/*.js

Last updated

Was this helpful?