Summary
A path traversal vulnerability in Wazuh cluster file synchronization allows a trusted cluster peer to influence where an uploaded archive is extracted. If the peer possesses the shared authentication key and the service processes crafted metadata, security-sensitive files may be overwritten, potentially enabling code execution after a service reload.
Affected context
The issue occurs in Wazuh cluster deployments where the master processes peer-supplied file metadata during synchronization. Risk is present when a cluster peer can authenticate with the shared Fernet key and the file synchronization logic accepts a destination path without confirming that it remains within the intended cluster directory.
Exploit preconditions
- Attack surface: Wazuh cluster file synchronization on the master
- Required access: A cluster peer with the shared Fernet authentication key
- Trigger point: Processing of peer-supplied
file_pathmetadata from an uploaded archive - Why exploitation is possible: The destination is joined to the Wazuh installation path without a reliable containment check against the directory selected by the cluster item key
Why this happens
The underlying bug is an insufficiently constrained file path used during archive processing. A peer-controlled path is combined with a trusted base location, but the resulting destination is not rigorously verified to remain within the authorized synchronization directory. This behavior maps to CWE-73, External Control of File Name or Path, because untrusted metadata influences filesystem access and can redirect writes to sensitive locations.
Potential impact
- Sensitive Wazuh configuration files may be overwritten
- Security monitoring and response behavior could be altered
- Root-executed commands may be configured through modified service settings
- Code execution may occur after a privileged service reload
- Cluster integrity, availability, or collected security data could be compromised
General mitigation guidance
Mitigation generally focuses on enforcing a strict filesystem trust boundary
for all cluster-supplied paths.
Common defensive patterns include:
- Resolve candidate paths and verify that they remain beneath an explicitly authorized directory
- Reject absolute paths, traversal components, symlink escapes, and unexpected archive members
- Derive destinations from trusted server-side identifiers rather than peer-controlled filenames
- Apply strict archive extraction policies and validate metadata before writing files
- Protect shared cluster keys and limit which systems can participate as peers
- Run synchronization services with the least filesystem and process privileges possible
- Separate writable synchronization areas from privileged configuration locations
How teams detect issues like this
Detection approaches may include:
- Static analysis for path joins involving peer-controlled metadata without canonicalization and containment checks
- Code review of archive extraction, file synchronization, and configuration replacement logic
- Rules that flag filesystem writes derived from network or cluster-peer input
- Runtime monitoring for unexpected writes outside approved synchronization directories
- File-integrity monitoring for changes to privileged Wazuh configuration files
- Policy enforcement requiring authenticated peers, protected key storage, and restricted cluster membership

