CVE-2026-40106
Wazuh Server vulnerability analysis and mitigation

Overview

CVE-2026-40106 is a heap-based buffer overflow vulnerability in the syscheck component of the Wazuh agent for Windows, affecting versions 4.6.0 through 4.14.4. When expanding registry paths containing wildcards (* or ?), the agent allocates a fixed 256-byte heap buffer (OS_SIZE_256); a low-privileged local attacker can create a registry subkey with a maximum-length name (255 characters) inside a monitored path to trigger an out-of-bounds write during string concatenation. Because wazuh-agent.exe runs as NT AUTHORITY\SYSTEM, this can result in a silent Denial of Service or potentially Local Privilege Escalation (LPE). The vulnerability was published on July 17, 2026, and patched in version 4.14.5. NVD assigns a CVSS v3.1 base score of 7.8 (High), while the GitHub advisory rates it 4.7 (Moderate) with higher attack complexity (GitHub Advisory).

Technical details

The root cause is a heap-based buffer overflow (CWE-122) in syscheck_op.c within the w_expand_by_wildcard function, present in both the ? and * wildcard evaluation branches. The code allocates a fixed 256-byte buffer via os_calloc(OS_SIZE_256, sizeof(char), full_path) and then uses unsafe strcpy/strcat calls to concatenate the base path (first_part), the matching subkey name (*query_keys), and any remaining path (second_part) without bounds checking. Since the Windows API permits registry subkey names up to 255 characters, a base path of even 32 bytes combined with a 255-character subkey name yields 287 bytes — well beyond the 256-byte boundary — corrupting adjacent heap metadata (LFH/Backend allocator). The attack vector is local, requires low privileges, and no user interaction, with low attack complexity per NVD scoring (GitHub Advisory).

Impact

Successful exploitation can cause the wazuh-agent.exe process to crash with a STATUS_HEAP_CORRUPTION (0xC0000374) exception, effectively blinding the EDR/SIEM agent to malicious activity on the endpoint (Denial of Service). A sophisticated attacker employing Heap Feng Shui techniques could potentially manipulate the heap layout to overwrite adjacent object pointers and achieve arbitrary code execution as NT AUTHORITY\SYSTEM, constituting a full Local Privilege Escalation. The confidentiality, integrity, and availability impacts are all rated High under NVD's scoring, reflecting the potential for complete system compromise (GitHub Advisory).

Exploitation steps

  1. Reconnaissance: Identify a Windows host running Wazuh agent versions 4.6.0–4.14.4 where the attacker has low-privileged local access and the agent's ossec.conf is configured to monitor a registry wildcard path accessible to standard users (e.g., HKEY_CURRENT_USER\Software\*).
  2. Configure monitored path (if attacker has influence): Confirm or social-engineer an administrator to add a wildcard registry path under HKEY_CURRENT_USER in ossec.conf, such as <registry>HKEY_CURRENT_USER\Software\WazuhTest\*</registry>, so the syscheck component will enumerate subkeys under that path.
  3. Create malicious registry subkey: As a standard (low-privileged) user, open PowerShell and execute: New-Item -Path "HKCU:\Software\WazuhTest\$('A'*255)" -Force to create a subkey with a 255-character name inside the monitored wildcard path.
  4. Trigger syscheck scan: Wait for the Wazuh syscheck thread to perform its scheduled registry scan (or trigger a manual scan if possible). The w_expand_by_wildcard function will attempt to concatenate the base path and the 255-character subkey name into the 256-byte buffer.
  5. Achieve DoS or LPE: The strcat operation writes beyond the allocated heap buffer, corrupting adjacent heap metadata. The wazuh-agent.exe process crashes with STATUS_HEAP_CORRUPTION (DoS). A sophisticated attacker could use Heap Feng Shui to control the heap layout and redirect execution to attacker-controlled code running as NT AUTHORITY\SYSTEM (LPE) (GitHub Advisory).

Indicators of compromise

  • Process: wazuh-agent.exe crashing unexpectedly with exception code STATUS_HEAP_CORRUPTION (0xC0000374); Windows Error Reporting (WER) generating crash dumps for wazuh-agent.exe.
  • Registry: Presence of a registry subkey under a Wazuh-monitored wildcard path (e.g., HKEY_CURRENT_USER\Software\WazuhTest\) with a name consisting of 255 repeated characters (e.g., 255 × 'A').
  • Logs: Windows Application Event Log entries showing wazuh-agent.exe process termination or fault bucket entries referencing heap corruption; absence of expected Wazuh syscheck log entries following a crash (agent goes silent).
  • File System: Windows crash dump files (.dmp) in %LOCALAPPDATA%\CrashDumps or %WINDIR%\Minidump associated with wazuh-agent.exe (GitHub Advisory).

Mitigation and workarounds

Wazuh has released version 4.14.5, which fixes the buffer overflow by properly handling registry path expansion with wildcards; all users running versions 4.6.0 through 4.14.4 should upgrade immediately. As a temporary workaround where upgrading is not immediately possible, administrators should avoid configuring wildcard registry monitoring paths (* or ?) under registry hives writable by low-privileged users (e.g., HKEY_CURRENT_USER), or restrict write access to monitored registry paths. Organizations in environments where unprivileged users have write access to monitored registry paths should treat this as a high-priority update (GitHub Advisory).

Community reactions

The vulnerability was discovered by security researcher bytecodesky (finder) and analyzed by hwpark6804-gif and Darioortegaleyva, with remediation developed by the Wazuh team and published via GitHub Security Advisory on July 16, 2026. No significant broader media coverage or notable social media commentary beyond the official advisory has been identified at this time (GitHub Advisory).

Additional resources

  • GitHub Advisory — Official Wazuh security advisory with PoC and technical details
  • VulDB Entry — VulDB vulnerability database entry for CVE-2026-40106
  • CVE Report — CVE report aggregator entry

SourceThis report was generated using AI

Related Wazuh Server vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-28220HIGH8.4
  • Wazuh Server logoWazuh Server
  • cpe:2.3:a:wazuh:wazuh
NoYesJul 20, 2026
CVE-2026-40106HIGH7.8
  • Wazuh Server logoWazuh Server
  • cpe:2.3:a:wazuh:wazuh
NoYesJul 17, 2026
CVE-2026-39359HIGH7.5
  • Wazuh Server logoWazuh Server
  • cpe:2.3:a:wazuh:wazuh
NoYesJul 17, 2026
CVE-2026-34150HIGH7.5
  • Wazuh Server logoWazuh Server
  • cpe:2.3:a:wazuh:wazuh
NoYesJul 17, 2026
CVE-2026-44251MEDIUM6.5
  • Wazuh Server logoWazuh Server
  • cpe:2.3:a:wazuh:wazuh
NoYesJul 17, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management