rmcp
Affected
- introduced
0, fixed2.0.0(semver)
Fixed versions
2.0.0
Fix
- Fixed version
2.0.0cargo update -p rmcp --precise 2.0.0
Advisory
Also known as: CVE-2026-63127
RMCP: Missing Resource Field Validation in OAuth Protected Resource Metadata Discovery
Summary
The rmcp library does not validate the resource parameter in OAuth Protected Resource metadata (RFC 9728), allowing a malicious MCP server to redirect OAuth flows to a legitimate authorization server and steal the resulting access tokens.
Details
RFC 9728 specifies two MUST requirements for resource parameter validation:
resource value in the returned metadata document.resource value returned is not identical to the URL the client used, the data MUST NOT be used.In the current implementation (crates/rmcp/src/transport/auth.rs), the ResourceServerMetadata struct (lines 390–394) does not include a resource field:
struct ResourceServerMetadata {
authorization_server: Option<String>,
authorization_servers: Option<Vec<String>>,
scopes_supported: Option<Vec<String>>,
}
And discover_oauth_server_via_resource_metadata() (lines 1446–1465) proceeds without any resource URL validation.
Recommended fix
resource field to the struct: rust struct ResourceServerMetadata { resource: Option<String>, // RFC 9728 REQUIRED field authorization_server: Option<String>, authorization_servers: Option<Vec<String>>, scopes_supported: Option<Vec<String>>, } // RFC 9728: validate that the resource identifier matches our target server
if let Some(resource) = &resource_metadata.resource {
if resource.trim_end_matches('/') != self.base_url.as_str().trim_end_matches('/') {
return Err(AuthError::MetadataError(format!(
"Resource metadata mismatch: expected '{}', got '{}'",
self.base_url, resource
)));
}
}
```
PoC
fake-mcp.com/mcp. fake-mcp.com/mcp/.well-known/oauth-protected-resource, the attacker serves metadata declaring: - resource: real-mcp.com/mcp (the legitimate server) - authorization_servers: the legitimate authorization server(s) of real-mcp.com/mcprmcp to connect to fake-mcp.com/mcp.rmcp fetches the protected resource metadata and, without validating that the resource field (real-mcp.com/mcp) differs from the configured server (fake-mcp.com/mcp), initiates an OAuth flow with the legitimate authorization server.real-mcp.com/mcp — is sent to fake-mcp.com/mcp in subsequent requests.real-mcp.com/mcp.Impact
This is an access token theft vulnerability via OAuth resource metadata spoofing. All MCP clients built on rmcp that rely on OAuth-protected MCP servers are affected. An attacker who tricks a user into connecting to a malicious MCP server can steal valid access tokens for any legitimate MCP server, enabling full impersonation of the victim.
Credit
Jian Cui, Minsun Shim, Zhou Li, Xiaojing Liao
University of Illinois Urbana-Champaign (UIUC)
University of California, Irvine (UCI)
High Basis: The source's own band: HIGH
0, fixed 2.0.0 (semver)2.0.0
2.0.0cargo update -p rmcp --precise 2.0.0Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0