看板娘加载中
220 字
1 分钟
ctfshow stack overflow pwn79

shot 1 shot 2 shot 3 shot 4

主函数造成了栈溢出,而 ctfshow 函数调用了 strcpyinput 给原模原样整到 buf 上了,没有去管 input 的长度,也就是说 ctfshow 函数也会导致栈溢出的意思。

shot 5

根据题目提示我在 IDA 里找到了这样一个奇怪的函数,会把 esp(栈顶)赋值给 ebx。我溢出的时候会覆盖 ebp 但是肯定覆盖不到 esp,emm…

ret2reg

控制程序流执行控制的寄存器指向的位置的 shellcode(自主写入)

shot 6

这里没有直接的 call ebx,再找别的利用点

shot 7

这里的 leave 可以利用上。leave ret 是经典利用链了。

动调看看 leave 之前什么东西和 esp 是一伙的。

shot 8

ebxeax。那么没找到 call ebx 找到了 call eax,就用它了:

shot 9

exp:

shot 10 shot 11

ctfshow{50fbe458-86a8-400e-8e37-152046a64b8c}

ctfshow stack overflow pwn79
https://alf-ovo.cn/posts/ctfshow-stack-overflow-pwn79/
作者
AlF
发布于
2026-05-22
许可协议
CC BY-NC-SA 4.0