Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/scanner/oracle/xdb_sid.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Auxiliary::Report7include Msf::Exploit::Remote::HttpClient8include Msf::Auxiliary::Scanner910def initialize11super(12'Name' => 'Oracle XML DB SID Discovery',13'Description' => %q{14This module simply makes an authenticated request to retrieve15the sid from the Oracle XML DB httpd server.16},17'References' =>18[19[ 'URL', 'http://dsecrg.com/files/pub/pdf/Different_ways_to_guess_Oracle_database_SID_(eng).pdf' ],20],21'Author' => [ 'MC' ],22'License' => MSF_LICENSE23)2425register_options(26[27Opt::RPORT(8080),28OptString.new('DBUSER', [ false, 'The db user to authenticate with.', 'scott']),29OptString.new('DBPASS', [ false, 'The db pass to authenticate with.', 'tiger']),30])31end3233def run_host(ip)34begin3536user_pass = "#{datastore['DBUSER']}:#{datastore['DBPASS']}"3738res = send_request_raw({39'uri' => '/oradb/PUBLIC/GLOBAL_NAME',40'version' => '1.0',41'method' => 'GET',42'headers' =>43{44'Authorization' => "Basic #{Rex::Text.encode_base64(user_pass)}"45}46}, 5)4748if( not res )49vprint_error("Unable to retrieve SID for #{ip}:#{datastore['RPORT']} with #{datastore['DBUSER']} / #{datastore['DBPASS']}...")50return51end5253if (res.code == 200)54if (not res.body.length > 0)55# sometimes weird bug where body doesn't have value yet56res.body = res.bufq57end58sid = res.body.scan(/<GLOBAL_NAME>(\S+)<\/GLOBAL_NAME>/)59report_note(60:host => ip,61:port => datastore['RPORT'],62:proto => 'tcp',63:type => 'oracle_sid',64:data => sid,65:update => :unique_data66)67print_status("Discovered SID: '#{sid}' for host #{ip}:#{datastore['RPORT']} with #{datastore['DBUSER']} / #{datastore['DBPASS']}")68else69print_error("Unable to retrieve SID for #{ip}:#{datastore['RPORT']} with #{datastore['DBUSER']} / #{datastore['DBPASS']}...")70end71rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout72rescue ::Timeout::Error, ::Errno::EPIPE73end74end75end767778