bongtrop / hbctool

Hermes Bytecode Reverse Engineering Tool (Assemble/Disassemble Hermes Bytecode)
MIT License
444 stars 71 forks source link

The HBC version (94) is not supported. #40

Open lt1023 opened 9 months ago

lt1023 commented 9 months ago

please!

powereureka commented 9 months ago

i have a version with support of hbc v94

flex0geek commented 8 months ago

Hi, where is the version that help with v94.

jamesmacwhite commented 8 months ago

There is a fork that has it: https://github.com/gilcu3/hbctool under https://github.com/gilcu3/hbctool/tree/hbc94

Credit: https://www.linkedin.com/pulse/reverse-engineering-lovebox-react-native-app-high-level-zagaria-vmhre

There's also https://github.com/P1sec/hermes-dec/ which supports up to version 96 at the time of writing.

flex0geek commented 8 months ago

thank you @jamesmacwhite for your comment, Do you have documentation for the bytecodes of Hermes?

jamesmacwhite commented 8 months ago

thank you @jamesmacwhite for your comment, Do you have documentation for the bytecodes of Hermes?

This exists, which P1 security wrote: https://p1sec.github.io/hermes-dec/opcodes_table.html. The hermes-dec tool can also generate psedo JavaScript from the bytecode, but it's not technically going to be 100% accurate to the original JavaScript.

flex0geek commented 8 months ago

thank you so much for this link @jamesmacwhite, I'm trying to change the logic of the application and rebuild it successfully from the hasm file which outputs from hbctool the app that I'm working on is hermes v94 and the opcode table stops at 89, do you have recommendation for this? I want to do simple things like swap the condition from if not to if or something like that.

jamesmacwhite commented 8 months ago

You need to use the forked version and build the source yourself: https://github.com/gilcu3/hbctool/tree/hbc94

Then install package directly: https://github.com/gilcu3/hbctool/tree/hbc94?tab=readme-ov-file#contribution.

There is an alternative tool that has direct support for newer versions: https://github.com/P1sec/hermes-dec/, however I don't believe it can re-assemble.

I can't advise on modifying bytecode itself, as I've only done it for reverse engineering, not to modify an application.

flex0geek commented 8 months ago

thank you for that if u find a way to re-assemble it i will be thankful if you share it with me https://twitter.com/FlEx0Geek, thank you so much

jamesmacwhite commented 8 months ago

@flex0geek If you take a look at: https://www.linkedin.com/pulse/reverse-engineering-lovebox-react-native-app-high-level-zagaria-vmhre/, the author details how they reassembled a change they made. I haven't personally tried it, but use that as your reference.

As mentioned before you will need to clone the fork linked with the hbc94 branch, build the source and install the locally built package for hbctool to have version 94 support, then do what you need to do.

flex0geek commented 8 months ago

Thank you so much for this reference it will be helpful.