Skip to content

Commit f22295b

Browse files
authored
Land rapid7#19857, Ivanti HTTP Module fix
Land rapid7#19857, Ivanti HTTP Module fix
2 parents 90ad8b6 + 6ab32cd commit f22295b

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

lib/metasploit/framework/login_scanner/ivanti_login.rb

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,34 @@ module LoginScanner
88
# - Admin Login
99
class Ivanti < HTTP
1010

11+
DEFAULT_SSL_PORT = 443
12+
LIKELY_PORTS = [443]
13+
LIKELY_SERVICE_NAMES = [
14+
'Ivanti Connect Secure'
15+
]
16+
PRIVATE_TYPES = [:password]
17+
REALM_KEY = nil
18+
1119
def initialize(scanner_config, admin)
1220
@admin = admin
1321
super(scanner_config)
1422
end
1523

24+
def check_setup
25+
request_params = {
26+
'method' => 'GET',
27+
'uri' => normalize_uri('/dana-na/auth/url_default/welcome.cgi')
28+
}
29+
30+
res = send_request(request_params)
31+
32+
if res && res.code == 200 && res.body&.include?('Ivanti Connect Secure')
33+
return false
34+
end
35+
36+
'Application might not be Ivanti Connect Secure, please check'
37+
end
38+
1639
def create_admin_request(username, password, token, protocol, peer)
1740
{
1841
'method' => 'POST',
@@ -73,6 +96,8 @@ def do_admin_login(username, password)
7396
return { status: ::Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: 'Unable to connect to the Ivanti service' } if res.nil?
7497
return { status: ::Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: "Received an unexpected status code: #{res.code}" } if res.code != 302
7598

99+
return { status: ::Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: 'Unexpected response' } if !res.headers&.key?('location')
100+
76101
return { status: ::Metasploit::Model::Login::Status::SUCCESSFUL, proof: res.to_s } if res.headers['location'] == '/dana-na/auth/url_admin/welcome.cgi?p=admin%2Dconfirm'
77102

78103
if res.headers['location'] == '/dana-admin/misc/admin.cgi'
@@ -122,7 +147,7 @@ def do_login(username, password)
122147
end
123148
return { status: ::Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: 'Unable to connect to the Ivanti service' } if res.nil?
124149
return { status: ::Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: "Received an unexpected status code: #{res.code}" } if res.code != 302
125-
return { status: ::Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: 'Unexpected response' } if res.blank?
150+
return { status: ::Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: 'Unexpected response' } if !res.headers&.key?('location')
126151

127152
if res.headers['location'] == '/dana-na/auth/url_default/welcome.cgi?p=ip%2Dblocked'
128153
sleep(2 * 60) # 2 minutes

0 commit comments

Comments
 (0)