MCP Registry has open redirect via protocol-relative path in trailing-slash middleware
Moderate severity
GitHub Reviewed
Published
May 4, 2026
in
modelcontextprotocol/registry
•
Updated May 15, 2026
Package
Affected versions
>= 1.1.0, < 1.7.5
Patched versions
1.7.5
Description
Published to the GitHub Advisory Database
May 8, 2026
Reviewed
May 8, 2026
Published by the National Vulnerability Database
May 14, 2026
Last updated
May 15, 2026
Summary
The TrailingSlashMiddleware in internal/api/server.go is vulnerable to an open redirect attack. An attacker can craft a URL with a protocol-relative path (e.g., //evil.com/) that, after trailing slash removal, results in a Location header of //evil.com — which browsers interpret as an absolute URL to an external domain.
Details
The TrailingSlashMiddleware strips trailing slashes from request paths and issues a 308 Permanent Redirect to the cleaned path. However, it does not validate or sanitize the resulting path before using it as the redirect target.
When a request is made with a path like //evil.com/, the middleware processes it as follows:
PoC
curl -v https://<registry-host>//evil.com/
3. Observe the 308 Permanent Redirect response with Location: //evil.com: 4. When accessed in a browser, the user is redirected to https://evil.comImpact
Phishing: Attackers can abuse the trusted registry domain to redirect users to credential-harvesting pages
Malware distribution: Redirect users to sites serving malicious downloads
Trust abuse: Links originating from the official MCP Registry domain carry implicit trust
References