The vulnerability lies in the lack of authentication and permissive CORS policy in the HTTP transport layer of @yoda.digital/gitlab-mcp-server. The analysis of the patch identified two key functions involved in this vulnerability.
The primary vulnerable function is setupTransport in src/transport.ts. This function is directly responsible for creating the HTTP server. Before the fix, it configured the server with wildcard CORS and no authentication, exposing sensitive endpoints. The patch addresses this by adding authentication logic, session-to-token binding, and stricter CORS controls directly within the request handler created in this function.
The second function, runServer in src/index.ts, is the entry point that initiates the server. It was also implicated because it lacked the necessary startup checks to prevent the server from starting in an insecure configuration. The patch added a critical safety gate (requireSafeTransportConfig) in runServer to ensure that the server will not start if configured in a way that exposes the unauthenticated transport to the network.
An attacker could exploit this by sending requests to the /sse and /messages endpoints of a vulnerable server instance. The wildcard CORS policy would allow these requests to be made from a malicious webpage visited by a user who has the server running, giving the attacker full access to the GitLab API with the server's credentials.