2010-04-30 08:40:19 +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-05-01 22:01:21 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::Scanner
|
2009-05-01 22:01:21 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Oracle XML DB SID Discovery',
|
|
|
|
'Description' => %q{
|
|
|
|
This module simply makes a authenticated request to retrieve
|
|
|
|
the sid from the Oracle XML DB httpd server.
|
|
|
|
},
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'URL', 'http://dsecrg.com/files/pub/pdf/Different_ways_to_guess_Oracle_database_SID_(eng).pdf' ],
|
|
|
|
],
|
|
|
|
'Author' => [ 'MC' ],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2009-05-01 22:01:21 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(8080),
|
|
|
|
OptString.new('DBUSER', [ false, 'The db user to authenticate with.', 'scott']),
|
|
|
|
OptString.new('DBPASS', [ false, 'The db pass to authenticate with.', 'tiger']),
|
|
|
|
], self.class)
|
|
|
|
end
|
2009-05-01 22:01:21 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run_host(ip)
|
|
|
|
begin
|
2009-05-01 22:01:21 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
user_pass = "#{datastore['DBUSER']}:#{datastore['DBPASS']}"
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
res = send_request_raw({
|
|
|
|
'uri' => '/oradb/PUBLIC/GLOBAL_NAME',
|
|
|
|
'version' => '1.0',
|
|
|
|
'method' => 'GET',
|
|
|
|
'headers' =>
|
|
|
|
{
|
|
|
|
'Authorization' => "Basic #{Rex::Text.encode_base64(user_pass)}"
|
|
|
|
}
|
|
|
|
}, 5)
|
2009-05-01 22:01:21 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if( not res )
|
|
|
|
vprint_error("Unable to retrieve SID for #{ip}:#{datastore['RPORT']} with #{datastore['DBUSER']} / #{datastore['DBPASS']}...")
|
|
|
|
return
|
|
|
|
end
|
2010-03-11 22:55:37 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if (res.code == 200)
|
|
|
|
if (not res.body.length > 0)
|
|
|
|
# sometimes weird bug where body doesn't have value yet
|
|
|
|
res.body = res.bufq
|
|
|
|
end
|
|
|
|
sid = res.body.scan(/<GLOBAL_NAME>(\S+)<\/GLOBAL_NAME>/)
|
|
|
|
report_note(
|
|
|
|
:host => ip,
|
|
|
|
:port => datastore['RPORT'],
|
|
|
|
:proto => 'tcp',
|
|
|
|
:type => 'oracle_sid',
|
|
|
|
:data => sid,
|
|
|
|
:update => :unique_data
|
|
|
|
)
|
|
|
|
print_status("Discovered SID: '#{sid}' for host #{ip}:#{datastore['RPORT']} with #{datastore['DBUSER']} / #{datastore['DBPASS']}")
|
|
|
|
else
|
|
|
|
print_error("Unable to retrieve SID for #{ip}:#{datastore['RPORT']} with #{datastore['DBUSER']} / #{datastore['DBPASS']}...")
|
|
|
|
end
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
2009-05-01 22:01:21 +00:00
|
|
|
end
|