@@ -73,9 +73,9 @@ def initialize(info = {})
73
73
74
74
def check
75
75
print_status ( 'Checking if the target is ISPConfig...' )
76
+ return CheckCode ::Unknown ( 'Failed to login' ) unless authenticate
76
77
# Always try to log in and parse version, since credentials are required
77
78
# cookie_jar.clear (handled in exploit)
78
- return CheckCode ::Safe unless authenticate
79
79
# Try to access the dashboard or settings page
80
80
settings_res = send_request_cgi ( {
81
81
'method' => 'GET' ,
@@ -111,16 +111,14 @@ def authenticate
111
111
} ,
112
112
'keep_cookies' => true
113
113
} )
114
- fail_with ( Failure :: NoAccess , 'Login request failed' ) unless res
114
+ return false unless res
115
115
if res &.code == 302
116
116
res = send_request_cgi ( {
117
117
'method' => 'GET' ,
118
118
'uri' => normalize_uri ( target_uri . path , 'login/' , res &.headers . fetch ( 'Location' , nil ) )
119
119
} )
120
120
end
121
- if res . body . match ( /Username or Password wrong/i )
122
- fail_with ( Failure ::NoAccess , 'Login failed: Invalid credentials' )
123
- end
121
+ return false if res . body . match ( /Username or Password wrong/i )
124
122
if res . headers . fetch ( 'Location' , nil ) &.include? ( 'admin' ) ||
125
123
res . body . downcase . include? ( 'dashboard' )
126
124
print_good ( 'Login successful!' )
@@ -250,9 +248,7 @@ def inject_payload
250
248
251
249
def exploit
252
250
cookie_jar . clear
253
- unless authenticate
254
- fail_with ( Failure ::NoAccess , 'Login failed' )
255
- end
251
+ fail_with ( Failure ::NoAccess , 'Authentication failed' ) unless authenticate
256
252
257
253
# Check if language editor permissions are enabled
258
254
unless check_langedit_permission
0 commit comments