1

I'm trying to change the instruction from jne to je

jne instruction

I've change an instruction

75 0c        jne [some_location]

75 0c is a 2 jump instruction.

So, I've a chaged it to from 75 0c to 74 0c which is also a 2 byte jcc instruction.

The error:

./binary: 1: 00000000:: not found
/* Repeat of the same error but instead of 0000000X where is X is some number */

EDIT: The problem was the hex editor was filtering lines and corrupting data? I was using nvim as the hex edior

7
  • 1
    Your question doesn't indicate what tool you're using when the error occurs. Apr 1, 2022 at 22:28
  • @RolfRolles It should be tool agnostic, right? Nothing here is really dependent on the tool I use. I use a disassembler to view the assembly and use a hex editor to edit the instruction.
    – user40683
    Apr 2, 2022 at 0:52
  • Oh, I misread. The program that you patched is generating this error, not the tool that did the patching. In any case, this question is impossible to answer. We have 3 lines of assembly code and the knowledge that if you invert a jump, the program spits out a message that it didn't produce before you patched it. What answer are you looking for beyond "you altered the logic of the program, and its behavior changed as a result"? Apr 2, 2022 at 15:19
  • We can help you better with more info on the binary - maybe attach it? Additionally any more details on the crash/error in the patched binary - maybe run it under a debugger?
    – sudhackar
    Apr 5, 2022 at 10:57
  • @RolfRolles The problem was the hex editor was filtering lines and corrupting data? I switched do a new hex editor. I was using nvim and it was filtering liines
    – user40683
    Apr 6, 2022 at 3:03

2 Answers 2

2

You do not need to use an hexadecimal editor with radare2. r2 is a reverse engineering framwork. It does everything.

First ensure radare2 is updated with the latest version:

git clone https://github.com/radareorg/radare2
sh radare2/sys/install.sh

Then open your program in write mode, replace NAMEOFYOURPROGRAM by the name of the program that you want to patch. Then you can overwrite the instruction:

radare2 -a x86 -b 32 -w NAMEOFYOUREXECUTABLE
=> s 0x1343
=> "wa jn 0x1351"
2

If you want to swap a conditional jump you can use the wao command like this: r2 -qc 'wao recj @ 0x1343' -w YOURPROGRAM.

But you can also use:

  • wx 74@0x1343
  • wai jne 0x1351@0x1343
  • woa 01@!1

(there are many other ways to achieve the same, pick the one you like more)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.