Summary
A flaw in Wazuh's Cluster Distributed API (DAPI) allows a cluster peer, or anyone who can authenticate with the shared cluster key, to make the master node deserialize attacker-controlled callables and run them under an attacker-selected RBAC context.
When JSON requests are processed with overly permissive callable resolution and client-supplied RBAC permissions, an attacker can escalate privileges and perform administrative actions on the Wazuh manager.
Affected context
This vulnerability appears in Wazuh deployments that:
- Run in clustered mode using the Cluster Distributed API (DAPI)
- Rely on a shared cluster key for peer authentication to the cluster channel
- Use JSON deserialization via
as_wazuh_object()with a broad allowlist for callables - Accept and apply client-supplied RBAC permissions for DAPI requests
In such environments, any authenticated cluster peer or actor with access to the cluster key can influence deserialization behavior and RBAC evaluation on the master node.
Exploit preconditions
- Attack surface: Wazuh cluster communication channel and DAPI endpoints on the master node
- Required access: Ability to authenticate to the cluster channel using the shared cluster key (as a legitimate or compromised peer)
- Trigger point: Submission of crafted DAPI requests whose JSON payload is processed by
as_wazuh_object()and whoserbac_permissionsandrbac_modevalues are accepted and applied byrun_local() - Why exploitation is possible: The deserialization routine resolves callables from broadly allowed packages (
wazuhandapi) based on client-controlled input, and the RBAC engine trusts client-supplied permissions and mode, allowing an attacker to bypass authorization checks and execute privileged operations.
Why this happens
The root cause is a combination of unsafe deserialization and insecure authorization context handling.
The JSON deserialization logic (as_wazuh_object()) functions as a dynamic object loader that interprets untrusted payload data as references to callables in wazuh or api packages.
Because the allowlist is overly broad and the mapping from JSON to executable callables is not constrained to a fixed, non-extensible set of operations, this maps directly to CWE-502: Unsafe Deserialization, where untrusted data drives code execution.
In parallel, the DAPI handler accepts client-supplied rbac_permissions and rbac_mode and applies them as a global RBAC context without independently deriving or validating them against established identities.
This insecure pattern allows an attacker to both select the callable being invoked and the authorization context under which it runs, turning deserialization into a remote code execution and privilege escalation primitive.
Potential impact
- An attacker can execute arbitrary privileged administrative actions on the Wazuh master node.
- The attacker could write or modify files under
WAZUH_PATH, impacting configuration and internal data. - Creation of new API users with elevated roles may be possible, enabling persistent control over the manager.
- Tampering with
security.yamland related security configuration could weaken or disable protections. - The compromise of the master node can be extended into full manager takeover and deeper environment intrusion.
General mitigation guidance
Mitigation focuses on removing unsafe deserialization patterns and decoupling authorization context from client control.
Common defensive approaches include:
- Restricting deserialization to data-only structures, avoiding any support for loading or resolving callables from input.
- Designing strict, immutable allowlists of operations that can be invoked remotely, with explicit mappings rather than package-wide resolution.
- Ensuring RBAC contexts are derived from authenticated identities on the server side, ignoring client-provided permission sets and modes.
- Applying least-privilege defaults for cluster peers, minimizing what administrative actions are available through DAPI.
- Segmenting cluster communication channels and protecting shared keys to reduce who can access management APIs.
These patterns help ensure that even if an attacker can send crafted JSON to the cluster, it cannot trigger arbitrary code paths under elevated privileges.
How teams detect issues like this
Potential detection strategies include:
- Static analysis checks for deserialization helpers that resolve callables or import modules based on untrusted input, especially patterns like
package.functionstrings interpreted from JSON. - Code review practices that flag any server-side acceptance of client-supplied permission sets, roles, or RBAC modes used to establish global authorization context.
- Logging and monitoring of DAPI requests for anomalous
rbac_permissionsandrbac_modevalues, particularly unexpected uses of permissive modes such as "black" or configurations that bypass resource protections. - Policy-based enforcement that requires explicit validation of cluster peer identities and forbids dynamic invocation of callables constructed from network data.
- Integration of automated security review tools that search for CWE-502-style unsafe deserialization constructs and improper trust in authorization metadata within backend services.

