CVE-2026-5789 Overview
CVE-2026-5789 is an unquoted search path vulnerability affecting CivetWeb v1.16, a popular lightweight embedded web server. This vulnerability allows a local attacker to execute arbitrary code with elevated privileges by placing a malicious executable in a directory that is scanned before the intended application path. The flaw exists due to the absence of quotes in the service configuration for the CivetWeb executable path (C:\Program Files\CivetWeb\CivetWeb.exe --).
Critical Impact
Local attackers with limited privileges can achieve arbitrary code execution with elevated system privileges by exploiting the unquoted service path, potentially leading to complete system compromise.
Affected Products
- CivetWeb v1.16
- CivetWeb Project CivetWeb (cpe:2.3:a:civetweb_project:civetweb:1.16)
Discovery Timeline
- 2026-04-21 - CVE-2026-5789 published to NVD
- 2026-04-22 - Last updated in NVD database
Technical Details for CVE-2026-5789
Vulnerability Analysis
This vulnerability is classified as CWE-428 (Unquoted Search Path or Element), a configuration flaw that occurs when Windows services or applications reference executable paths containing spaces without proper quoting. When a service path like C:\Program Files\CivetWeb\CivetWeb.exe is not enclosed in quotes, Windows parses the path sequentially, attempting to execute programs at each space-delimited segment before reaching the intended executable.
The exploitation mechanics work as follows: Windows will first attempt to locate C:\Program.exe, then C:\Program Files\CivetWeb\CivetWeb.exe. An attacker with write access to C:\ or C:\Program Files\CivetWeb\ can place a malicious executable named Program.exe that will be executed before the legitimate CivetWeb service.
Root Cause
The root cause of this vulnerability lies in improper service configuration during CivetWeb installation. When the service is registered with the Windows Service Control Manager (SCM), the ImagePath registry value is set without enclosing quotes around the executable path. Since the path C:\Program Files\CivetWeb\CivetWeb.exe contains spaces, Windows path parsing behavior creates opportunities for path interception attacks.
Attack Vector
The attack requires local access to the target system. An attacker with write permissions to directories in the search path can exploit this vulnerability by:
- Creating a malicious executable file named Program.exe in the C:\ root directory
- Waiting for the CivetWeb service to start or restart
- When the service starts, Windows executes the attacker's Program.exe instead of the intended CivetWeb application
- The malicious code runs with the privileges of the CivetWeb service, typically SYSTEM level
The vulnerability requires low attack complexity and no user interaction once the malicious file is in place. The attacker needs only local access and low privileges (write access to a directory in the path) to exploit this flaw.
Detection Methods for CVE-2026-5789
Indicators of Compromise
- Presence of unexpected executables named Program.exe in the C:\ root directory
- Suspicious Program.exe files in C:\Program Files\ or C:\Program Files\CivetWeb\ directories
- Unusual process execution chains where service host processes spawn unexpected child processes
- Modifications to the ImagePath registry value for the CivetWeb service
Detection Strategies
- Monitor Windows service configurations for unquoted paths containing spaces using PowerShell queries against the registry
- Implement file integrity monitoring (FIM) for root directories and common path injection locations
- Use endpoint detection tools to identify unauthorized executables in system directories
- Scan for services with unquoted paths using tools like wmic service get name,displayname,pathname,startmode | findstr /i /v "C:\Windows\\" | findstr /i /v """
Monitoring Recommendations
- Enable Windows process creation auditing (Event ID 4688) to track executable launches
- Configure file system auditing on directories susceptible to unquoted path attacks
- Implement behavioral detection for privilege escalation patterns involving service exploitation
- Monitor for changes to service registry entries under HKLM\SYSTEM\CurrentControlSet\Services\
How to Mitigate CVE-2026-5789
Immediate Actions Required
- Audit all installed services for unquoted paths containing spaces and remediate immediately
- Remove any suspicious executables from root directories and path injection locations
- Apply the principle of least privilege to directory permissions, restricting write access to system paths
- Consider disabling the CivetWeb service until proper remediation can be applied
Patch Information
No vendor patch information is currently available. Organizations should monitor the INCIBE Security Notice for updates regarding official remediation guidance from the CivetWeb project.
Workarounds
- Manually fix the service path by adding quotes around the ImagePath registry value for the CivetWeb service
- Restrict write permissions on the C:\ root directory and other directories in the vulnerable path
- Implement application whitelisting to prevent unauthorized executables from running
- Use endpoint protection solutions to block execution of unsigned binaries in sensitive directories
# Registry fix to properly quote the CivetWeb service path
reg add "HKLM\SYSTEM\CurrentControlSet\Services\CivetWeb" /v ImagePath /t REG_EXPAND_SZ /d "\"C:\Program Files\CivetWeb\CivetWeb.exe\"" /f
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


