iT邦幫忙

2025 iThome 鐵人賽

DAY 25
0

React Native APP 開發者也可能使用 Hermes 來編譯JavaScript 面對這樣方式 我們可以去decompile 來分析原始邏輯

編譯過的JavaScript

如之前所提到的 開發者只要在 gradle.properties 把 hermesEnabled 設為True
JS可以被 Hermes engine 轉成 Hermes ByteCode 來進行混淆 增加逆向難度
當看到 index.android.boundle 是看不懂的亂碼時 就有可能是被編譯過的程式碼

https://ithelp.ithome.com.tw/upload/images/20251006/20149459khaNYnfFVl.jpg

我們可以透過file 的方式去確認

file index.android.bundle

https://ithelp.ithome.com.tw/upload/images/20251006/20149459z8whJw7UXd.jpg

他確實是 Hermes JavaScript ByteCode

接下來我們可以諄對這個對他做Decompiled 使用 hermes-dec 這個工具

pip3 install --upgrade git+https://github.com/P1sec/hermes-dec
hbc-decompiler index.android.bundle output.js

反編譯完就能夠查看裡面的邏輯等等
https://ithelp.ithome.com.tw/upload/images/20251006/20149459W6yK88gjHh.jpg
以上是React Native 的靜態分析 從一般壓縮JS的到編譯JS 可以透過以上方法分析去了解原始的邏輯


上一篇
DAY 24 靜態分析 - Hybrid APP 上
系列文
我是不可能一直學Android 絕對不會25
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言