Given the following x86 assembly instructions:
mov esi, offset off_A
cmp esi, offset off_B
how would I get the offsets (the second operand) at runtime ? This is the scenario: A program (injected into the process at runtime) replaces the offsets with a few of its own, resulting in:
mov esi, offset off_X
cmp esi, offset off_Y
This program allows plugins to be written and loaded through it but doesn’t expose the replacement addresses. So, given the addresses at which the above instructions exist, how do I find offsets X and Y ?
I don’t quite understand what this is for, but…
mov esi, ...is encoded asBEfollowed by the dword operand. If you’ve got the address of themovinstruction you can simply skip one byte ahead and see the address operand,off_Acmp esi, ...is encoded as81 FEfollowed by a dword operand, so here you can skip two bytes to see the operand.