/

CVE-2026-39359

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in Wazuh Manager Daemons

CVE-2026-39359

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Exposure of Sensitive Configuration Files

Severity:

HIGH RISK

(7.5)

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 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.keys containing agent keys and authentication material.
  • Internal configuration files like ossec.conf may 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.

Sources

SourceLink
github.comgithub.com/wazuh/wazuh/security/advisories/GHSA-6q95-fcwc-4h44

Frequently asked

questions

Yes. An attacker who can interact with the Wazuh Manager as an enrolling agent over the network can exploit this issue by providing crafted group names, without needing local access to the server filesystem.

The attacker needs the ability to enroll a new agent or impersonate an agent during enrollment. Direct shell access to the Wazuh Manager host is not required, but control over the agent-side enrollment process is.

The safest pattern is to strictly decouple logical identifiers from filesystem paths: reject any group name containing traversal or path characters, construct paths only from trusted server-side mappings, and enforce that all resolved paths remain within a defined base directory.

Adopt secure coding standards that mandate validation and canonicalization of all externally sourced path components, use centralized utility functions for safe path handling, apply regular code review and static analysis focused on CWE-22, and minimize trust in client-supplied identifiers across enrollment and configuration workflows.

Find out what's already
exploitable in your codebase.