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
here's how pwntools create the ROP chain for stack migration (using the leave ; ret gadget):
elifpop_bpandleaveandlen(pop_bp.regs) ==1:
self.raw(pop_bp)
self.raw(next_base-4) # <-- what about x64 binary ?self.raw(leave)
As you can see it set the bp register to next_base-4, then use the leave;ret gadget to migrate the stack to next_base. This work in x86 binaries, but not in x64 binaries ( would have to be self.raw(next_base-8) not self.raw(next_base - 4) )
The text was updated successfully, but these errors were encountered:
I found this bug when I was doing a CTF challenge, which I need to do stack migration in a x64 binary.
If I use the original function (rop.migrate(buf)), it will migrate the stack to the wrong address, causing the exploit crash the program. I ended up writing my own function to make the exploit work, something like:
here's how pwntools create the ROP chain for stack migration (using the
leave ; ret
gadget):As you can see it set the
bp
register tonext_base-4
, then use theleave;ret
gadget to migrate the stack tonext_base
. This work in x86 binaries, but not in x64 binaries ( would have to beself.raw(next_base-8)
notself.raw(next_base - 4)
)The text was updated successfully, but these errors were encountered: