CVE-2025-24016: Github.com/wazuh/wazuh Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-hcrc-79hj-m3qh
CVSS 9.9
CWE-502
Published
Advisory Summary

CVE-2025-24016 is a CRITICAL (CVSS 9.9) remote code execution vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Github.com/wazuh/wazuh libraries in the Go ecosystem. The issue involves wazuh server vulnerable to remote code execution. Remediation is available by upgrading affected packages to version 4.9.1.

CVE-2025-24016 at a Glance

CVE Identifier CVE-2025-24016
GHSA Identifier GHSA-hcrc-79hj-m3qh
Severity CRITICAL
CVSS v3.1 Base Score 9.9
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Github.com/wazuh/wazuh
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H/E:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2025-24016

To remediate this vulnerability, upgrade all affected Github.com/wazuh/wazuh dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/wazuh/wazuh fixed: 4.9.1
Upgrade github.com/wazuh/wazuh to 4.9.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/wazuh/wazuh

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-24016, inspect your project dependencies for Github.com/wazuh/wazuh:

inspect dependencies for github.com/wazuh/wazuh

Analyze the terminal output to locate any version of Github.com/wazuh/wazuh in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.9.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Github.com/wazuh/wazuh, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 `as_wazuh_object` (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 (`__unhandled_exc__`) to evaluate arbitrary python code. Using the server API, it quite easy to trigger. For example, using the `run_as` endpoint (implemented by `run_as_login` in `api/api/controllers/security_controller.py`): the `auth_context` argument is completely controlled by the attacker, and is forwarded to the master server to handle. By sending a malicious `run_as` 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/{agent_id}/config/{component}/{configuration}` (`api.controllers.agent_controller.get_agent_config`), 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 (`as_wazuh_object`), 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 `as_wazuh_object`, 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 '{"__unhandled_exc__":{"__class__": "exit", "__args__": []}}' https://<worker-server>:55000/security/user/authenticate/run_as ``` 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)

CVE-2025-24016 Affected Github.com/wazuh/wazuh Versions

1 component(s)
Fixed Versions:
4.9.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/wazuh/wazuh
Go
≥ 4.4.0
< 4.9.1
4.9.1

References

Frequently Asked Questions

What is CVE-2025-24016?
CVE-2025-24016 is a security vulnerability in Github.com/wazuh/wazuh involving Wazuh server vulnerable to remote code execution under CWE-502: Deserialization of Untrusted Data.
Which Github.com/wazuh/wazuh versions are affected?
Affected versions include releases prior to 4.9.1 across affected packages: github.com/wazuh/wazuh.
What version fixes CVE-2025-24016?
Upgrading to 4.9.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/wazuh/wazuh affected?
Yes, github.com/wazuh/wazuh is affected in releases prior to 4.9.1. Upgrade your dependency to 4.9.1 or later.
What is the CVSS score of CVE-2025-24016?
CVE-2025-24016 has a CVSS v3.1 base score of 9.9 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H/E:H.
What CWE is associated with CVE-2025-24016?
CVE-2025-24016 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check Go dependencies for CVE-2025-24016?
Run the dependency tree command: 'inspect dependencies for github.com/wazuh/wazuh'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hcrc-79hj-m3qh",
  "modified" : "2025-10-22T19:27:44Z",
  "published" : "2025-04-22T16:53:39Z",
  "aliases" : [ "CVE-2025-24016" ],
  "summary" : "Wazuh server vulnerable to remote code execution",
  "details" : "### Summary\nAn unsafe deserialization vulnerability allows for remote code execution on Wazuh servers.  \nThe 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.\n\n### Details\nDistributedAPI parameters are a serialized as JSON and deserialized using `as_wazuh_object` (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 (`__unhandled_exc__`) to evaluate arbitrary python code.  \n\nUsing the server API, it quite easy to trigger. For example, using the `run_as` endpoint (implemented by `run_as_login` in `api/api/controllers/security_controller.py`): the `auth_context` argument is completely controlled by the attacker, and is forwarded to the master server to handle. By sending a malicious `run_as` request to a worker server, it is possible to execute code on the master server.\n\nIt is also possible to exploit the bug as a compromised agent, in certain configurations.  \nA 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/{agent_id}/config/{component}/{configuration}` (`api.controllers.agent_controller.get_agent_config`), 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.\n\n```\nuser          server A              server B         agent\n  |               |                     |             |\n  | -get-config-> |                     |             |\n  |               | --get-config-dapi-> |             |\n  |               |                     | --getconf-> |\n  |               |                     | <-payload-- |\n  |               X <-----payload------ |             |\n  |               |                     |             |\n```\n\nIt is likely that there are more ways to reach the unsafe deserialization function (`as_wazuh_object`), 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 `as_wazuh_object`, easier by using a  `__callable__`, or potentially abusing callable gadgets in `exception`, `wresults` or `Wazuh`.\n\n### PoC\nTo trigger using the server API (assuming default credentials):  \n```bash\ncurl -X POST -k -u \"wazuh-wui:MyS3cr37P450r.*-\" -H \"Content-Type: application/json\" --data '{\"__unhandled_exc__\":{\"__class__\": \"exit\", \"__args__\": []}}' https://<worker-server>:55000/security/user/authenticate/run_as\n```\nthis will shut down the master server.\n\n### Impact\nThis is a remote code execution on Wazuh server, affecting the latest version (v4.9.0 at this time)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H/E:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/wazuh/wazuh"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.4.0"
      }, {
        "fixed" : "4.9.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/wazuh/wazuh/security/advisories/GHSA-hcrc-79hj-m3qh"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-24016"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/wazuh/wazuh"
  }, {
    "type" : "WEB",
    "url" : "https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2025-24016"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-04-22T16:53:39Z",
    "nvd_published_at" : "2025-02-10T20:15:42Z"
  }
}