/

CVE-2026-28220

Severity:

HIGH RISK

(8.4)

Unsafe JSON Deserialization (CWE-502) in Wazuh DAPI

CVE-2026-28220

Analyzed

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution and Privilege Escalation in Cluster Master

Severity:

HIGH RISK

(8.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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 whose rbac_permissions and rbac_mode values are accepted and applied by run_local()
  • Why exploitation is possible: The deserialization routine resolves callables from broadly allowed packages (wazuh and api) 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.yaml and 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.function strings 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_permissions and rbac_mode values, 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.

Sources

SourceLink
github.comgithub.com/wazuh/wazuh/security/advisories/GHSA-w2jj-pfq9-mh9p

Frequently asked

questions

Yes, it can be exploited over the network by any party that can authenticate to the Wazuh cluster channel using the shared cluster key or act as a legitimate cluster peer, allowing them to send crafted DAPI requests to the master node.

The attacker must obtain or possess the shared cluster key, or otherwise gain peer-level access to the cluster communication channel. They do not need direct shell access to the master node, but they do need to be recognized as an authenticated participant in the cluster.

The safest pattern is to completely remove the ability for deserialization routines to interpret untrusted input as callables or executable objects, and to ensure that any remote operation is mapped to a fixed, server-controlled set of functions. At the same time, RBAC permissions and modes should be computed on the server side from authenticated identities, never taken from client-provided fields.

Future designs should treat all serialized input as untrusted data and avoid binding it directly to executable code paths. Implement strict deserialization to simple data schemas, enforce robust RBAC that cannot be altered by clients, and include security reviews and automated checks for unsafe deserialization and authorization logic whenever new APIs or cluster features are introduced.

Find out what's already
exploitable in your codebase.