Shell Injection and Untrusted Search Path in Wazuh wazuh-agent and wazuh-manager Enable Arbitrary Command Execution

Note: This data is for reference and cybersecurity research purposes only.CyStack advises users not to use this information for unlawful purposes.

What is CVE-2025-15616?

CVE-2025-15616 is a vulnerability classified as Improper Control of Generation of Code, affecting wazuh-agent (affected versions: 2.1.0 – < 4.8.0) and wazuh-manager (affected versions: 2.1.0 – < 4.8.0). This vulnerability is rated High, with a CVSS score of 7.1. Public exploit code or evidence is available for this vulnerability, but that does not confirm exploitation in the wild.

Overview

Original source data

Wazuh wazuh-agent and wazuh-manager versions 2.1.0 before 4.8.0 contain multiple shell injection and untrusted search path vulnerabilities that allow attackers to execute arbitrary commands through various components including logcollector configuration, maild SMTP server tags, and Kaspersky AR script parameters. Attackers can exploit these vulnerabilities by injecting malicious commands through configuration files, SMTP server settings, and custom flags to achieve remote code execution on affected systems.

Affected products and scope

The record identifies two affected Wazuh packages:

  • wazuh-agent: affected starting at 2.1.0 and through versions less than 4.8.0, using semver. The record's default status is unaffected for versions not listed in the affected range.
  • wazuh-manager: affected starting at 2.1.0 and through versions less than 4.8.0, using semver. The record's default status is unaffected for versions not listed in the affected range.

The Wazuh advisory lists 4.8.0 and later within the patched versions range for both packages.

Technical details

The vulnerability is classified as CWE-94 and affects several Wazuh components that execute commands:

  • wazuh-logcollector can execute commands read from configuration.
  • When operating in local server mode, wazuh-maild executes the command configured in the <smtp_server> tag.
  • Multiple commands are invoked without a full path, creating an untrusted search path or path hijacking condition. The vendor advisory uses net.exe on Windows as an example: the operating system can find a malicious executable in the ossec-agent installation directory or elsewhere on the search path before selecting the intended executable.
  • The Kaspersky AR script is vulnerable to code injection when it uses extra_args together with the --custom_flags flag.

Attacker-controlled values can enter through configuration files, SMTP settings, and custom flags, but exploitation requires high privileges to modify or influence those inputs. The available evidence does not fully describe parsing, escaping, or every affected call site, so a specific payload or exploit string should not be inferred beyond the documented components.

Exploitability

The supplied metrics describe network reachability, low attack complexity, a high privilege requirement, and no need for additional user interaction. The network vector does not identify one specific endpoint or protocol; practical exploitation depends on whether the attacker can access or modify the relevant configuration, service settings, or custom flags.

The Wazuh advisory includes proof-of-concept material for wazuh-maild, path hijacking, and the Kaspersky AR script. The record also identifies public exploit material, while the reviewed evidence does not name a campaign, victim, or confirmed in-the-wild exploitation.

Technical impact

The flaws can lead to arbitrary command execution on systems running Wazuh through shell injection or path hijacking. Direct consequences can include modification of files and configuration, altered monitoring behavior, service interruption, and code execution with the privileges of the Wazuh process.

  • The integrity and availability of an affected host may be seriously compromised.
  • Data accessible to the service account may also be exposed, although the evidence does not describe a specific data-exfiltration scenario.
  • Exploitation requires high privileges, so practical risk depends substantially on the attacker's ability to control administrative configuration or service inputs.
  • The supplied assessment treats the impact as remaining within the vulnerable system's security scope; no evidence establishes automatic lateral movement or impact to other systems.

Business impact

Successful exploitation can allow commands to run with the privileges of a Wazuh process, enabling unauthorized system changes, service disruption, or execution of unapproved software.

  • Shell injection through configuration or parameters can compromise the integrity of an agent or manager host.
  • Path hijacking can cause an unintended executable to run in place of the expected program, particularly in Windows deployments where the search path is not controlled.
  • If the Wazuh process has broad permissions, the practical impact may extend to resources available to its service account and may result in host compromise.
  • The record provides no evidence of a confirmed data breach, named victim, or specific exfiltration event.

Remediation

  1. Upgrade both wazuh-agent and wazuh-manager to 4.8.0 or a later release covered by the vendor's patched versions range. Do not assume that updating one package automatically protects the other.
  2. If an immediate upgrade is not possible, restrict administrative access that can change configuration files, SMTP settings, custom flags, or command-execution behavior. Treat this as temporary containment, not a substitute for patching.
  3. Review wazuh-maild local server mode, wazuh-logcollector configuration, and Kaspersky AR parameters to remove unnecessary or untrusted command-bearing values.
  4. On Windows, inspect and restore executables in the ossec-agent directory and the process search path to a trusted baseline, and investigate unmanaged files that Wazuh could invoke.
  5. After updating, review configuration-change history, process telemetry, and service-account permissions for unauthorized command execution. The available evidence does not provide a specific IOC set, so version, configuration, and telemetry checks should be combined.

Detection

Use the following checks:

  1. Inventory the versions of wazuh-agent and wazuh-manager separately and compare them with the affected range in the record.
  2. Review configuration content and change permissions for wazuh-logcollector, wazuh-maild local server mode, the <smtp_server> tag, and Kaspersky AR parameters using extra_args or --custom_flags.
  3. On Windows, inspect the ossec-agent directory and the process search path for executables outside the trusted baseline, especially names that Wazuh may invoke without a full path.
  4. Review process telemetry and audit logs around Wazuh service restarts or configuration reloads for unexpected child processes or commands. This is precautionary monitoring, not a confirmed indicator of compromise.
  5. Check configuration-change history and administrative access records for unauthorized changes. The absence of suspicious logs does not prove safety, and the available evidence does not provide a specific IOC set or named campaign.
Sources (13)
Learn more

Run an in-depth assessment with complete web risk management

CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.