Summary
Wazuh contains a missing authorization check in the agent upgrade handler, allowing an enrolled agent to submit an unauthorized custom-upgrade request with a controlled file path. Under deployments affected by this flaw, an attacker may read arbitrary files as root, including sensitive credentials such as /etc/shadow and client.keys.
Wazuh contains a missing authorization check in the agent upgrade handler, allowing an enrolled agent to submit an unauthorized custom-upgrade request with a controlled file path. Under deployments affected by this flaw, an attacker may read arbitrary files as root, including sensitive credentials such as /etc/shadow and client.keys.
Affected context
The vulnerability occurs in Wazuh deployments using the agent upgrade functionality and agent communication channel. It becomes risky when an attacker controls or compromises an enrolled agent and the upgrade handler processes custom upgrade requests without verifying whether the requested operation is authorized.
The vulnerability occurs in Wazuh deployments using the agent upgrade functionality and agent communication channel. It becomes risky when an attacker controls or compromises an enrolled agent and the upgrade handler processes custom upgrade requests without verifying whether the requested operation is authorized.
Exploit preconditions
- Attack surface: Wazuh agent communication channel and upgrade handler
- Required access: Control of, or code execution within, an enrolled agent
- Trigger point: Processing of a custom upgrade request containing an attacker-controlled file path
- Why exploitation is possible: The handler does not adequately verify authorization or request origin before accessing the specified path
- Attack surface: Wazuh agent communication channel and upgrade handler
- Required access: Control of, or code execution within, an enrolled agent
- Trigger point: Processing of a custom upgrade request containing an attacker-controlled file path
- Why exploitation is possible: The handler does not adequately verify authorization or request origin before accessing the specified path
Why this happens
The underlying issue is a missing authorization decision in the wm_agent_upgrade processing path. A request from an enrolled agent is accepted as sufficient authority to perform a privileged file operation, without validating whether the requested custom upgrade action and target path are permitted. This maps to CWE-862: Missing Authorization, where an application fails to enforce an access-control check before allowing a protected operation.
The underlying issue is a missing authorization decision in the wm_agent_upgrade processing path. A request from an enrolled agent is accepted as sufficient authority to perform a privileged file operation, without validating whether the requested custom upgrade action and target path are permitted. This maps to CWE-862: Missing Authorization, where an application fails to enforce an access-control check before allowing a protected operation.
Potential impact
- Attackers may read arbitrary files accessible to the Wazuh process
- Sensitive credentials, hashes, keys, or configuration data could be disclosed
- The confidentiality of managed hosts may be reduced
- Exposed agent keys could support further unauthorized interaction
- Attackers could use recovered information for lateral movement or follow-on attacks
- Attackers may read arbitrary files accessible to the Wazuh process
- Sensitive credentials, hashes, keys, or configuration data could be disclosed
- The confidentiality of managed hosts may be reduced
- Exposed agent keys could support further unauthorized interaction
- Attackers could use recovered information for lateral movement or follow-on attacks
General mitigation guidance
Mitigation generally focuses on enforcing authorization at the point where agent-originated upgrade requests are interpreted.
Defensive patterns include:
- Require explicit authorization for custom upgrade operations rather than trusting enrollment alone
- Validate request origin, agent identity, operation type, and permitted file locations
- Restrict file access to an allowlisted, dedicated upgrade directory
- Avoid running upgrade handlers with unnecessary root privileges
- Apply least-privilege service accounts and filesystem permissions
- Protect agent credentials and rotate them when compromise is suspected
- Use secure-by-default policies that disable custom file-based upgrade behavior unless required
Mitigation generally focuses on enforcing authorization at the point where agent-originated upgrade requests are interpreted.
Defensive patterns include:
- Require explicit authorization for custom upgrade operations rather than trusting enrollment alone
- Validate request origin, agent identity, operation type, and permitted file locations
- Restrict file access to an allowlisted, dedicated upgrade directory
- Avoid running upgrade handlers with unnecessary root privileges
- Apply least-privilege service accounts and filesystem permissions
- Protect agent credentials and rotate them when compromise is suspected
- Use secure-by-default policies that disable custom file-based upgrade behavior unless required
How teams detect issues like this
Detection approaches can include:
- Static analysis and code review for file operations performed before authorization checks
- Searching for upgrade handlers that accept client-controlled paths or filenames
- Monitoring agent-channel traffic for unusual custom upgrade requests
- Alerting on Wazuh processes reading sensitive system files
- Enforcing policies that require allowlisted paths and explicit authorization for privileged agent actions
- Reviewing audit logs for unexpected access to credential stores, shadow files, or agent key material
Detection approaches can include:
- Static analysis and code review for file operations performed before authorization checks
- Searching for upgrade handlers that accept client-controlled paths or filenames
- Monitoring agent-channel traffic for unusual custom upgrade requests
- Alerting on Wazuh processes reading sensitive system files
- Enforcing policies that require allowlisted paths and explicit authorization for privileged agent actions
- Reviewing audit logs for unexpected access to credential stores, shadow files, or agent key material

