Summary
Wazuh Manager before 5.0.0-beta3 fails to correctly escape the DataValue.index field when building OpenSearch bulk NDJSON requests, allowing agents to inject arbitrary operations.
When a malicious or compromised agent can control this field, it can smuggle delete, index, or update actions executed with the manager's admin privileges, leading to SIEM data tampering and cross-agent state manipulation.
Affected context
This vulnerability arises in Wazuh deployments where the manager constructs OpenSearch bulk requests based on agent-supplied data.
It is most relevant in environments where agents are enrolled but not fully trusted, or where an attacker can compromise an agent or intercept and modify its outbound traffic.
The issue appears when the DataValue.index field is inserted into NDJSON request bodies without proper escaping or structure validation, allowing injected OpenSearch operations to be processed as if they were legitimate bulk actions.
Exploit preconditions
- Attack surface: Wazuh Manager's OpenSearch integration endpoint that processes bulk NDJSON requests.
- Required access: Ability to enroll a malicious agent, compromise an existing agent, or manipulate traffic between an agent and the manager.
- Trigger point: Submission of crafted data in the DataValue.index field such that, when concatenated into an NDJSON bulk body, it introduces additional OpenSearch operations.
- Why exploitation is possible: The manager embeds the field directly into NDJSON without escaping special characters or enforcing strict schema boundaries, allowing attacker-controlled text to break out of its intended context and be interpreted as standalone bulk operations under administrative credentials.
Why this happens
The underlying bug aligns with CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component.
Wazuh Manager takes input from agents (the DataValue.index field) and uses it to construct NDJSON payloads for OpenSearch bulk APIs without neutralizing control characters or enforcing structure.
This insecure pattern of directly concatenating untrusted data into a protocol-specific payload allows the input to alter the meaning of the output, enabling the injection of unintended delete, index, or update operations processed by the downstream OpenSearch cluster.
Potential impact
- An attacker may delete existing SIEM documents, including logs or alerts, to hide malicious activity.
- A compromised agent could tamper with alert data, injecting false positives or false negatives into the index.
- Cross-agent manipulation of SIEM state could occur, where one agent's data corrupts or overrides records attributed to other agents.
- An attacker can potentially disrupt detection, incident response, and compliance reporting by corrupting the underlying OpenSearch data.
- The integrity and reliability of security monitoring dashboards and reports may be significantly degraded.
General mitigation guidance
Mitigation should focus on enforcing strict separation between agent-supplied data and protocol-level control structures in bulk NDJSON payloads.
Recommended defensive patterns include:
- Treating all agent-provided fields as data only and ensuring they are properly escaped or encoded so they cannot alter NDJSON structure.
- Implementing server-side schema validation that restricts allowed characters and formats for index-related fields before constructing bulk requests.
- Using structured composition APIs or libraries for OpenSearch requests rather than manual string concatenation, so control and data are cleanly delineated.
- Applying least-privilege principles to search and indexing credentials, limiting what bulk operations the manager can perform where feasible.
- Introducing additional authorization checks so that agents cannot indirectly request destructive operations (such as deletes) beyond their intended scope.
How teams detect issues like this
Detection efforts can center on both code-level patterns and runtime behavior:
- Static analysis rules to flag direct concatenation of untrusted fields into protocol-specific payloads (e.g., NDJSON, SQL, XML) without escaping.
- Code reviews focusing on output construction routines for OpenSearch or other backend integrations, checking for missing sanitization, schema enforcement, or use of safe builders.
- Logging and monitoring of OpenSearch bulk operations for anomalous delete or update patterns originating from Wazuh Manager, especially operations targeting unexpected indices or documents.
- Security policies in CI/CD that require use of structured client libraries and prohibit manual assembly of NDJSON or query payloads from raw user or agent input.
- Automated application security testing tools configured to search for injection vectors in data pipelines between agents and backend stores.

