The vulnerability is a DNS rebinding attack in the vet MCP server's SSE transport mode. The root cause is a failure to validate the Host and Origin headers of incoming HTTP requests. This allows a malicious website to trick a victim's browser into sending requests to the vet server running on localhost and exfiltrating sensitive data from the scan database.
The analysis of the patch commit 0ae3560ba11846375812377299fe078d45cc3d48 reveals the exact locations of the vulnerability. The patch introduces two new middleware functions, hostGuard and originGuard, to perform the necessary header validation.
The key vulnerable functions identified are:
server.NewMcpServerWithSseTransport: This function was responsible for setting up the SSE server's HTTP handler chain. Before the patch, it did not include any validation, making it the central point of the vulnerability. The patch adds the hostGuard and originGuard here.
server.sseHandlerWithHeadSupport: This middleware handled HEAD requests and insecurely set the Access-Control-Allow-Origin header to *. This permissive CORS policy explicitly told the browser to allow cross-origin reads, which is essential for the attacker to steal data.
main.startMcpServer: This function, part of the command's entry point, initiated the server with a default, insecure configuration. The patch adds logic to incorporate user-defined security settings from the command line.
During an exploit, a profiler would show calls passing through the HTTP handler chain. The absence of hostGuard and originGuard in the stack trace of a vulnerable version is the key indicator. Instead, requests would be handled directly by functions like sseHandlerWithHeadSupport and the underlying SSE server handler without proper security checks.