Summary
A path traversal vulnerability in Wazuh cluster synchronization allows a trusted or compromised peer to influence file paths used when processing merged synchronization archives. If the peer has access to the shared cluster encryption key and synchronization reaches the vulnerable processing path, it may overwrite sensitive files and potentially achieve code execution through service configuration changes.
Affected context
The issue occurs in Wazuh cluster deployments that process synchronization archives from cluster peers. It is associated with path construction using peer-controlled merge metadata and insufficient confinement of resulting paths to the intended cluster item directory. Risk is greatest where a peer can authenticate to the cluster synchronization mechanism, possess the shared Fernet key, and influence files that are later reloaded or executed by privileged Wazuh services.
Exploit preconditions
- Attack surface: Wazuh cluster synchronization and merged archive processing
- Required access: A cluster peer position or equivalent ability to produce authenticated synchronization data, including access to the shared Fernet key
- Trigger point: Processing of merge metadata or merged-file headers by the master
- Why exploitation is possible: Peer-controlled path components are not adequately confined to the declared cluster item directory, allowing writes outside the intended path
- Additional condition for code execution: A sensitive, root-managed configuration or executable file must be overwritten and subsequently loaded or executed by a Wazuh service
Why this happens
The underlying bug is improper canonical path confinement. Wazuh constructs filesystem paths from values supplied through cluster synchronization data but does not reliably verify that the resolved path remains beneath the intended destination directory. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly called path traversal. The insecure pattern is trusting archive metadata or file headers as safe path components without robust normalization and containment checks before writing files.
Potential impact
- An attacker may overwrite arbitrary files writable by the Wazuh service
- Sensitive configuration or policy files could be modified
- Wazuh services may load attacker-controlled settings
- Root-level command execution could occur if privileged service configuration is replaced
- Monitoring, detection, and response capabilities could be disrupted
- The affected host or connected infrastructure could be exposed to further compromise
General mitigation guidance
Mitigation generally focuses on enforcing strict filesystem boundaries and reducing trust in synchronization metadata.
Common defensive patterns include:
- Resolve candidate paths and verify that they remain within an approved destination directory before writing
- Reject absolute paths, traversal components, unexpected separators, and ambiguous path encodings
- Prefer allowlisted file names and schema-validated synchronization records over arbitrary path values
- Separate archive extraction from privileged configuration locations
- Run synchronization components with the minimum filesystem and operating-system privileges required
- Protect cluster keys and restrict peer enrollment to authorized, monitored nodes
- Use service controls that prevent unauthorized configuration changes from being loaded automatically
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules that identify filesystem writes built from archive metadata or network-controlled strings
- Code review checks for canonicalization followed by containment validation before file access
- Tests covering absolute paths, traversal sequences, encoded separators, symlinks, and platform-specific path behavior
- Runtime monitoring for Wazuh service writes outside approved directories
- File-integrity monitoring on sensitive configuration files such as
ossec.conf - Policy enforcement that restricts cluster peers, protects shared keys, and audits synchronization activity
Automated security review tools may help identify suspicious path-joining and archive-extraction patterns, but should be supplemented with deployment-level controls.

