CVE-2025-24016: Wazuh Server Deserialization of Untrusted Data Vulnerability
Summary An unsafe deserialization vulnerability allows for remote code execution on Wazuh servers. 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.
Details DistributedAPI parameters are a serialized as JSON and deserialized using aswazuhobject (in 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 (unhandledexc) to evaluate arbitrary python code.
Using the server API, it quite easy to trigger. For example, using the runas endpoint (implemented by runaslogin in api/api/controllers/securitycontroller.py): the authcontext argument is completely controlled by the attacker, and is forwarded to the master server to handle. By sending a malicious runas request to a worker server, it is possible to execute code on the master server.
It is also possible to exploit the bug as a compromised agent, in certain configurations. A compromised agent can respond to a getconfig request with a malicious JSON object (containing a serialized unhandled exception). If the getconfig request was caused because of a server API request to /agents/{agentid}/config/{component}/{configuration} (api.controllers.agentcontroller.getagentconfig), and the agent is managed by a server other than the one that received the server API request, the unsafe deserialization will occur on the server that received the original server API request.
user server A server B agent | | | | | -get-config-> | | | | | --get-config-dapi-> | | | | | --getconf-> | | | | <-payload-- | | X <-----payload------ | | | | | |
It is likely that there are more ways to reach the unsafe deserialization function (aswazuhobject), some of them might even be accessible from different contexts (without credentials, or initiated by a compromised agent). I suggest fixing the root cause instead of attempting to sanitize inputs that reach it. Note that there are multiple other ways to execute arbitrary code in aswazuhobject, easier by using a callable, or potentially abusing callable gadgets in exception, wresults or Wazuh.
PoC To trigger using the server API (assuming default credentials): bash curl -X POST -k -u "wazuh-wui:MyS3cr37P450r.-" -H "Content-Type: application/json" --data '{"unhandledexc":{"class": "exit", "args": []}}' https://<worker-server>:55000/security/user/authenticate/runas this will shut down the master server.
Impact This is a remote code execution on Wazuh server, affecting the latest version (v4.9.0 at this time)
Other sources
Wazuh contains a deserialization of untrusted data vulnerability that allows for remote code execution on Wazuh servers.
— CISA
Wazuh is a free and open source platform used for threat prevention, detection, and response. Starting in version 4.4.0 and prior to version 4.9.1, an unsafe deserialization vulnerability allows for remote code execution on Wazuh servers. DistributedAPI parameters are a serialized as JSON and deserialized using aswazuhobject (in 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 (unhandledexc) 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. Version 4.9.1 contains a fix.
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/wazuh/wazuhto a version that resolves this vulnerability.Fixed in 4.9.1 - Upgrade
Upgrade
Wazuhto a version that resolves this vulnerability.Fixed in 4.9.1 - Compensating control
Limit/disable API access to Wazuh server endpoints that can trigger the unsafe deserialization (e.g., the `security/user/authenticate/run_as` path and agent config endpoints like `/agents/{agent_id}/config/{component}/{configuration}`), so only trusted sources (e.g., internal Wazuh servers) can reach them.
Event History
Frequently Asked Questions
What is the severity of CVE-2025-24016?
CVE-2025-24016 has a severity rating that indicates a critical risk due to the potential for remote code execution.
How do I fix CVE-2025-24016?
To fix CVE-2025-24016, upgrade your Wazuh installation to version 4.9.1 or later.
What versions of Wazuh are affected by CVE-2025-24016?
CVE-2025-24016 affects Wazuh versions starting from 4.4.0 up to and including 4.9.0.
What type of vulnerability is CVE-2025-24016?
CVE-2025-24016 is categorized as an unsafe deserialization vulnerability.
Can CVE-2025-24016 be exploited remotely?
Yes, CVE-2025-24016 can be exploited remotely, allowing attackers to execute arbitrary code on vulnerable servers.