Summary
RMCP: Missing Resource Field Validation in OAuth Protected Resource Metadata Discovery
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:
- Section 7.3: the client MUST ensure that the resource identifier URL it is using as the prefix for the metadata request exactly matches the
resourcevalue in the returned metadata document. - Section 3.3: if the
resourcevalue 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.
PoC
Attacker sets up a malicious MCP server at
fake-mcp.com/mcp.At
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/mcp
- resource:
Victim configures any MCP client using
rmcpto connect tofake-mcp.com/mcp.rmcpfetches the protected resource metadata and, without validating that theresourcefield (real-mcp.com/mcp) differs from the configured server (fake-mcp.com/mcp), initiates an OAuth flow with the legitimate authorization server.The victim sees a legitimate authorization prompt and completes the flow.
The resulting access token, valid for
real-mcp.com/mcp, is sent tofake-mcp.com/mcpin subsequent requests.The attacker captures the token and can impersonate the victim on
real-mcp.com/mcp.
Credit
Jian Cui, Minsun Shim, Zhou Li, Xiaojing Liao
University of Illinois Urbana-Champaign (UIUC)
University of California, Irvine (UCI)
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.
CVE-2026-63127 has a CVSS score of 8.2 (High). The vector is network-reachable, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.0.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
- Add the
resourcefield to the struct:struct ResourceServerMetadata { resource: Option<String>, // RFC 9728 REQUIRED field authorization_server: Option<String>, authorization_servers: Option<Vec<String>>, scopes_supported: Option<Vec<String>>, } - Add validation logic after fetching metadata:
let Some(resource_metadata) = self .fetch_resource_metadata_from_url(&resource_metadata_url) .await? else { return Ok(None); }; // 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 ))); } }
Frequently Asked Questions
- What is CVE-2026-63127? CVE-2026-63127 is a high-severity security vulnerability in rmcp (rust), affecting versions < 2.0.0. It is fixed in 2.0.0.
- How severe is CVE-2026-63127? CVE-2026-63127 has a CVSS score of 8.2 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of rmcp are affected by CVE-2026-63127? rmcp (rust) versions < 2.0.0 is affected.
- Is there a fix for CVE-2026-63127? Yes. CVE-2026-63127 is fixed in 2.0.0. Upgrade to this version or later.
- Is CVE-2026-63127 exploitable, and should I be worried? Whether CVE-2026-63127 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-63127 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-63127? Upgrade
rmcpto 2.0.0 or later.