Summary
A path traversal flaw in Wazuh Manager's enrollment and synchronization daemons allows agents to specify malicious group names containing parent directory sequences.
When exploited, sensitive configuration files from the manager's /var/ossec/etc directory can be unintentionally synchronized to a compromised or malicious agent.
Affected context
This vulnerability affects Wazuh Manager deployments where agents enroll dynamically and are permitted to select their own group during the enrollment phase.
The issue lies in how group names are validated in the authd process and later consumed by remoted to construct filesystem paths for configuration synchronization.
Environments with untrusted or partially trusted agents, such as multi-tenant or distributed infrastructures, are particularly exposed when agent enrollment is not tightly restricted.
Exploit preconditions
- Attack surface: Wazuh Manager network interface used for agent enrollment and configuration synchronization.
- Required access: Ability to register or impersonate an agent and supply a crafted group name containing path traversal sequences (for example,
..). - Trigger point: The enrollment daemon (authd) accepts the attacker-controlled group name, stores it in the manager's global database, and remoted later uses it to build synchronization paths.
- Why exploitation is possible: The group name is insufficiently validated for path traversal characters;
wopendir()checks only for directory existence, allowing..to resolve to a valid parent directory under/var/ossec/etc, and remoted then reuses this unchecked value to include unintended files in the shared configuration stream.
Why this happens
The root cause is insufficient input validation on a filesystem-related parameter that is treated as a logical identifier but used directly as part of a filesystem path.
The authd daemon trusts the group value supplied by agents and only verifies that the resulting directory exists using wopendir(), which happily resolves .. to the parent folder.
This unchecked, attacker-controlled path segment is later concatenated in remoted when assembling paths for configuration synchronization.
As captured in CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), the software fails to constrain the effective path to an intended subdirectory, enabling access to files in adjacent directories.
Potential impact
- An attacker-controlled agent may receive sensitive files such as
client.keyscontaining agent keys and authentication material. - Internal configuration files like
ossec.confmay be disclosed, exposing network topology, rules, and tuning that can aid further attacks. - Internal certificates and related cryptographic material can be leaked, potentially undermining secure channels and trust relationships.
- Compromise of the Wazuh monitoring and response plane, enabling broader lateral movement or evasion of security monitoring across the environment.
General mitigation guidance
Mitigation typically focuses on constraining path usage and hardening the trust boundary around agent-supplied identifiers.
Common defensive patterns include:
- Treating group names and similar identifiers strictly as opaque logical values, not as path fragments, and normalizing or rejecting any input containing
.., slashes, or other traversal indicators. - Implementing canonicalization and enforced directory boundaries when constructing paths; resolve the path and verify it still resides under the intended base directory before use.
- Maintaining a server-side, curated mapping of agent groups to directories instead of letting agents dictate directory names directly.
- Applying least privilege to Wazuh Manager processes and file system layout, so even if a path calculation fails, the process cannot read unnecessary sensitive files.
- Restricting agent enrollment with authentication, authorization, and, where feasible, manual approval or pre-registration to reduce exposure to untrusted agents.
How teams detect issues like this
Effective detection approaches can combine code-level analysis with runtime monitoring:
- Static analysis rules that flag use of agent-supplied or network-sourced strings in filesystem operations (e.g., open, opendir, wopendir) without normalization or traversal checks.
- Code review checklists that explicitly require validation and canonicalization of any external identifier used to construct file paths, especially for configuration and synchronization mechanisms.
- Configuration and policy enforcement that prohibit directory names containing path separators,
.., or other traversal sequences in enrollment-related workflows. - Runtime logging and monitoring of unusual group names or synchronization paths, with alerts on directory traversal patterns or unexpected file inclusion in configuration streams.
- Use of automated security scanners or SAST tools configured with CWE-22 rules to continuously scan the Wazuh codebase and related integration scripts.

