老套路放进IDA分析发现
此处是一个明显的栈溢出。
我们可以通过溢出name来覆盖fp
1)openfile:打开文件,文件指针就是fp,不能打开文件名为flag的文件
2)readfile:从fp读取0x18F个字节到magicbuf上
3)closefile:关闭文件,指针fp赋0
4)writefile:只是一个打印函数,而不能写入,不能打印{flag,FLAG,}名的文件,如下
伪造FILE结构体来getshell的题目
exp:
from pwn import *
context(arch='i386', os='linux', terminal=['tmux', 'splitw', '-h'])
context.log_level='debug'
debug = 0
d = 1
if debug == 1:
p = process("./seethefile")
if d == 1: