I'm trying to put together a ROP chain. I'm looking for a gadget to do the following:
mov rdi, rdx ; mov rbp, rsp ; ret;
But instead, I have a gadget like this :
mov rdi, rdx ; mov rbp, rsp ; jmp 0x8109b3f7
So, I thought maybe I can use this gadget, all I have to do is pointing this jmp address ( 0x8109b3f7) to the next gadget address. But this is not working. I use GDB to set the jmp address like the following:
set *0x8109b3f7=0xgadget_address
It still points to the jmp address, not to the gadget address. Any help how can I do that?
N.B: I'm using x86-64 architecture.