CVE-2026-28221: Wazuh: Pre-auth stack-based buffer overflow in wazuh-remoted print_hex_string() due to signed char promotion on x86_64
Wazuh is a free and open source platform used for threat prevention, detection, and response. From version 4.8.0 to before version 4.14.4, a stack-based buffer overflow exists in printhexstring() in wazuh-remoted. The bug is triggered when formatting attacker-controlled bytes using sprintf(dstbuf + 2i, "%.2x", srcbuf[i]) on platforms where char is treated as signed and the compiled code sign-extends bytes before the variadic call. For input bytes such as 0xFF, the formatting can emit "ffffffff" (8 chars) instead of "ff" (2 chars), causing an out-of-bounds write past a fixed 2049-byte stack buffer. The vulnerable path is reachable remotely prior to any agent authentication/registration logic via TCP/1514 when an oversized length prefix causes the “unexpected message (hex)” diagnostic path to run. Additionally, the same unauthenticated oversized-message diagnostic path logs an attacker-controlled hex dump to /var/ossec/logs/ossec.log for each trigger, allowing remote log amplification that can degrade monitoring fidelity and consume disk/I/O. This log amplification is reachable even without triggering the sign-extension overflow (e.g., using bytes < 0x80). This issue has been patched in version 4.14.4.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-28221?
CVE-2026-28221 is rated as high severity due to the potential for remote code execution from a stack-based buffer overflow.
How do I fix CVE-2026-28221?
To fix CVE-2026-28221, upgrade Wazuh to version 4.14.4 or later.
What causes CVE-2026-28221?
CVE-2026-28221 is caused by a signed char promotion in the print_hex_string() function within the wazuh-remoted service.
Which versions of Wazuh are affected by CVE-2026-28221?
Wazuh versions from 4.8.0 to before 4.14.4 are affected by CVE-2026-28221.
Is CVE-2026-28221 a remote vulnerability?
Yes, CVE-2026-28221 is a pre-authentication vulnerability that can be exploited remotely.