You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could this tool insert some instruction for example nop in the specific addresses without any other unnecessary modification of the binary? Could you show some example code?
The text was updated successfully, but these errors were encountered:
It is possible to insert nop at specific locations in the code. However, Multiverse is designed in a way that it is not possible to only modify a subset of the code.
If you only want to replace certain instructions in a binary with nops, it would be better to write a simple script that patches those bytes in a binary. This approach shouldn't require any special tools (besides readelf to identify section offsets) as long as you have already identified the addresses you want to replace beforehand.
If instead you wish to insert nops in between currently existing instructions, you have the challenge that you are shifting code and therefore changing code offsets in a binary, which means everything after the inserted nops is at a different offset than in the original binary. In this case, a rewriter needs to handle references to code locations, either via offsets or absolute addresses. In Multiverse, this isn't a problem because we are rewriting everything and we translate code references at the point they are used in the rewritten code.
If you still wish to use Multiverse to insert nops, a simple example that inserts a nop before every instruction can be found here. In order to only insert nops before certain instructions, the count_instruction function only needs to be changed to check whether the instruction passed to it is at one of the desired addresses. Something like:
template = 'nop'
addresses = [<addresses you want>]
if inst.address in addresses:
return _asm(template)
Could this tool insert some instruction for example
nop
in the specific addresses without any other unnecessary modification of the binary? Could you show some example code?The text was updated successfully, but these errors were encountered: