I'm trying to patch a binary with ghidra. Though I'm able to replace an existing instruction with new one, I see no option to add new instructions to the same func. How can I do that? What am I missing?
Asked
Active
Viewed 1,712 times
1
-
2I don't know the first thing about ghidra, but it would not surprise me at all if expanding a function was not supported. After all, expanding a function beyond its current size (the current block alignment) would not only require relocating all the code that came after but also updating any image references straddling the new code. This is very complicated to do. – 500 - Internal Server Error Jun 23 '21 at 11:23
-
2ghidra allows you to change instructions but it doesn't support generating a new executable from it. I ended up using ghidra to view what changes I needed to make and a hex editor to actual make them. – Lieven Keersmaekers Jun 23 '21 at 11:36
-
2Ghidra does allow you to change instructions and export a new executable from it, but only in the new version 10 that was released _today_. The issues about extending a function still remain though, this can get fairly complicated really fast if you can't use existing empty space that was left for alignment reasons. – Florian Magin Jun 24 '21 at 09:04
-
1@FlorianMagin - Awesome, downloading as we speak. – Lieven Keersmaekers Jun 24 '21 at 11:14