DEV Community

SorrelThorncroft
SorrelThorncroft

Posted on

Wazuh-MCP-Server Validated a Hostname Before DNS Changed the Destination

Wazuh-MCP-Server Validated a Hostname Before DNS Changed the Destination

A URL validator that checks a string but not the address the network client will use leaves room for DNS and redirects to make the final decision. CVE-2026-138029 affected Wazuh-MCP-Server before commit 2bbfe12 because WebshellCheckInput.validate_url accepted DNS hostnames without resolving them.

Inside the webshell check

The blueteam_check_webshell tool supplied URLs to curl. A hostname could resolve to loopback, a private address, or a link-local endpoint. A redirect could also move the request after validation. The CVE record says the tool could reach internal services and cloud metadata and leak response details.

That last part matters. Some SSRF bugs produce only a timing or error signal. This one affected a security-analysis workflow that may return enough response information to tell an attacker whether an internal service exists and what it says.

Why URL syntax is not a network boundary

validate_url can reject malformed schemes and visible private IP literals while still accepting a domain that later resolves privately. The validator needs to resolve the hostname, inspect all returned addresses, pin the connection to an approved address, and repeat the process for each redirect. Simply resolving once and then letting curl resolve again creates a time-of-check gap.

Network policy should also prevent the MCP process from reaching metadata and management networks. A tool that checks webshells on customer websites does not need unrestricted access to the hosting platform's control plane.

Risk

The CVE gives CVSS 4.0 a base score of 5.3 and CVSS 3.1 a score of 4.7. The 3.1 vector requires user interaction and has low confidentiality impact with changed scope. The score is lower than many remote code execution findings, but security tooling often sits in a privileged network position. Impact should be assessed with the actual egress path, not only the base score.

Prompt injection or a malicious URL submitted through an agent conversation can influence the requested destination. The server must still enforce where curl may connect.

Remediation

Update to commit 2bbfe12 or a later release. Restrict egress from the Wazuh MCP service, block cloud metadata, and require explicit allow-lists for destinations used by webshell checks. If users provide URLs, resolve and validate them at connection time. Disable redirects or validate every hop.

Returning less detail on failed checks also reduces the tool's usefulness as a blind SSRF oracle. Differentiate user-facing errors while retaining enough internal evidence for defenders. Keep authorization on the MCP endpoint so an untrusted caller cannot use the analysis tool as a general-purpose HTTP client.

Verification

Test a public hostname that resolves to an internal listener, a hostname that redirects internally after the first response, and a direct metadata address. Record the DNS answers, connected address, redirect chain, and whether any response content is returned. Review proxy and firewall logs to confirm the application cannot bypass the intended route.

The fix address is a commit rather than a semantic version in the CVE. Inventory must therefore record the deployed source revision, not just a package name. An MCP server copied from a repository and started manually can remain vulnerable even when no conventional package appears in the software inventory.

References

Top comments (0)