/

CVE-2026-25770

Severity:

CRITICAL RISK

(9.1)

Privilege Escalation via Insecure Configuration and File

CVE-2026-25770

Analyzed

Vulnerability type

Category:

Privilege Escalation via Insecure Configuration and File Permissions

CWE:

CWE-22, CWE-269, CWE-732

Impact:

Remote Code Execution with Privilege Escalation to root

Severity:

CRITICAL RISK

(9.1)

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 privilege escalation chain in the Wazuh Manager cluster synchronization protocol allows authenticated cluster nodes to write arbitrary files as the wazuh system user and overwrite the main configuration file.

By injecting a malicious <localfile> command block into ossec.conf, an attacker can cause the root-running wazuh-logcollector service to execute arbitrary commands, resulting in full root remote code execution in affected environments.

Affected context

This vulnerability affects Wazuh deployments using clustered managers where:

  • The wazuh-clusterd service is enabled and accepts authenticated nodes for synchronization
  • Cluster nodes are allowed to write files to the manager's file system as the wazuh user
  • The wazuh user retains write access to critical configuration like /var/ossec/etc/ossec.conf
  • wazuh-logcollector runs with root privileges and processes configuration from ossec.conf

The risk is most relevant in environments where cluster credentials may be accessible to less-trusted nodes or operators, or where boundary assumptions around "trusted cluster members" are weak.

Exploit preconditions

  • Attack surface: Wazuh Manager cluster synchronization channel (typically network-accessible only to cluster nodes).
  • Required access: Valid cluster authentication/authorization as a node capable of participating in synchronization; no direct shell access to the manager is strictly required.
  • Trigger point: Use of the cluster protocol to write or overwrite files on the manager as the wazuh user, specifically targeting /var/ossec/etc/ossec.conf.
  • Why exploitation is possible:
  • The cluster protocol permits authenticated nodes to perform arbitrary file writes under the wazuh account.
  • Default file permissions allow the wazuh user to modify the main configuration file.
  • wazuh-logcollector, running as root, trusts and parses ossec.conf, including <localfile> command blocks that can spawn OS commands.
  • There is no strict separation of duties or privilege boundary between configuration writers and root-level execution of those configurations.

Why this happens

The underlying issue is a combination of insecure privilege boundaries and overly permissive file access controls in the cluster synchronization system.

At a design level, the cluster protocol (wazuh-clusterd) grants authenticated nodes the ability to write arbitrary files to the manager's file system as the wazuh user (CWE-269: Improper Privilege Management). This trust model is not constrained to a narrowly scoped set of paths or file types and is further weakened by default permissions that allow wazuh to modify the primary configuration file (ossec.conf) (CWE-732: Incorrect Permission Assignment for Critical Resource).

Because ossec.conf is consumed by a root-privileged component (wazuh-logcollector) that interprets <localfile> command blocks as instructions that may invoke system commands, a configuration write effectively becomes a code execution primitive. The absence of strict validation, segregation of configuration responsibilities, and least-privilege execution around these interacting components creates an escalation path from an authenticated cluster node to root-level command execution.

Potential impact

  • Remote execution of arbitrary commands as root on the Wazuh Manager host.
  • Complete compromise of the Wazuh Manager, including access to collected logs, alerts, keys, and other sensitive security data.
  • Lateral movement to other systems monitored or managed by Wazuh, depending on integration and trust relationships.
  • Tampering with security monitoring, including disabling rules, suppressing alerts, or injecting false log data.
  • Use of the compromised manager as a pivot point for broader infrastructure attacks.

General mitigation guidance

Mitigation strategies center on tightening privilege boundaries, constraining file writes, and hardening configuration handling:

  • Limit file write capabilities in cluster protocols:
  • Restrict cluster synchronization to a narrowly defined set of directories and file types.
  • Enforce explicit allowlists for files that cluster nodes may create or modify.
  • Harden file permissions for critical configuration:
  • Ensure the main configuration (ossec.conf and similar critical files) is writable only by a highly restricted account or root, not by service-level or cluster-managed users.
  • Regularly audit file ownership and permissions for configuration directories.
  • Strengthen configuration-to-execution boundaries:
  • Treat configuration-driven command execution (<localfile> and similar constructs) as high-risk and minimize or disable dynamic command invocation paths where possible.
  • Separate the duties of components that accept remote input from those that run with elevated privileges.
  • Apply least-privilege principles to services:
  • Where feasible, drop unnecessary root privileges from services that parse untrusted or remotely influenced configuration.
  • Use sandboxing, chroot, containers, or restricted execution environments for components that may be influenced via cluster protocols.
  • Constrain cluster exposure and trust:
  • Limit network access to the cluster manager ports via firewalls, network segmentation, and strict access control policies.
  • Treat cluster credentials as sensitive secrets, rotate them regularly, and avoid sharing them beyond strictly necessary nodes.

How teams detect issues like this

Effective detection involves both code/configuration review and runtime monitoring:

  • Static/code-level analysis:
  • Review cluster synchronization logic for generic file write operations, especially those that accept remote input and are not constrained to specific paths.
  • Search for service accounts (like wazuh) that can modify high-value configuration files and cross-reference with components that run as root and parse those files.
  • Incorporate static analysis rules or custom linters to flag:
  • Arbitrary file write APIs exposed via network-facing components.
  • Overly permissive file permissions on configuration directories.
  • Configuration and permission audits:
  • Periodically scan /var/ossec/etc (and equivalent directories) for improper ownership and write permissions.
  • Establish baseline checksums or integrity monitoring for ossec.conf and alert on unauthorized modifications.
  • Runtime and log-based detection:
  • Monitor cluster synchronization logs for unexpected or unusual file paths being written from cluster nodes.
  • Enable audit logging (e.g., OS-level auditd) to track who modifies ossec.conf and correlate changes with cluster events.
  • Alert on anomalous executions or command invocations originating from wazuh-logcollector or similar privileged services.
  • Security testing:
  • Integrate cluster-protocol abuse scenarios into regular penetration testing and red-team exercises.
  • Use automated configuration scanning tools to identify risky permission relationships between service accounts and root-privileged daemons.

Sources

SourceLink
github.comgithub.com/wazuh/wazuh/security/advisories/GHSA-r4f7-v3p6-79jm

Frequently asked

questions

Exploitation is scoped to environments where an attacker can obtain valid cluster node credentials or otherwise impersonate a cluster member. It is not typically exploitable by unauthenticated, external attackers on the open internet, but any compromise of a cluster node or leakage of cluster credentials can turn this into a critical escalation path.

No direct local shell access to the manager is required. An attacker needs network access to the cluster synchronization interface and valid cluster authentication. From there, they can abuse the protocol to write to ossec.conf and leverage the root-privileged log collector.

The safest pattern is to remove the ability for remotely influenced components to write critical configuration files and ensure those files are restricted to root or tightly controlled administrative accounts. Additionally, command execution features triggered via configuration should be minimized, tightly validated, or decoupled from root-privileged services.

Apply strict least-privilege principles across all service boundaries: cluster synchronization components should only write to narrowly scoped locations; configuration files that drive execution should be immutable to non-administrative services; and root-privileged daemons should avoid executing commands derived from data that can be influenced over the network. Combine design reviews, threat modeling, and automated permission/configuration audits to catch such trust-boundary violations early.

Find out what's already
exploitable in your codebase.