1 malloc
2 edit
3 free
4 print //TODO or …
堆内存指针数组 0x602140
利用unlink
unlink 发生情况
当上一个chunk未使用 即 chunk1(unuse) chunk2(use) chunk3(use)
//free chunk2时 ,向上合并
当下一个chunk未使用 即 chunk1(use) chunk2(use) chunk3(unuse)
//free chunk2时 ,向下合并
当上下chunk都未使用时 即 chunk1(unuse) chunk2(use) chunk3(unuse)
//free chunk2 时, 向上合并再向下合并
malloc 1 //有两个IO缓冲区
malloc 2 (0x420)
malloc 3 (0x420)
修改后
free malloc 3
从而绕过了unlink的检测
s[2] -- > s[-1]
修改got.free
执行流程
call plt.free
jmp [got.free]
修改后
call plt.free
jmp [got.free]
jmp [got.puts]
free(s[1]) == > puts(got.printf)
泄露libc地址
然后执行system("/bin/sh")
free(s[1]) == > system("/bin/sh")
该lib库的printf地址尾部为0x00
所以需要使用其他函数这里使用fgets