CVE-2026-63127: CWE-345: Insufficient Verification of Data Authenticity in modelcontextprotocol rust-sdk
### 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: - 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 `resource` value in the returned metadata document. - Section 3.3: if the `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: ```rust 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 1. Add the `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>>, } ``` 2. Add validation logic after fetching metadata: ```rust 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 ))); } } ``` ### PoC 1. Attacker sets up a malicious MCP server at `fake-mcp.com/mcp`. 2. 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` 3. Victim configures any MCP client using `rmcp` to connect to `fake-mcp.com/mcp`. 4. `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. 5. The victim sees a legitimate authorization prompt and completes the flow. 6. The resulting access token — valid for `real-mcp.com/mcp` — is sent to `fake-mcp.com/mcp` in subsequent requests. 7. The attacker captures the token and can impersonate the victim on `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)
AI Analysis
Technical Summary
The vulnerability arises from insufficient verification of data authenticity in the rmcp crate's OAuth implementation before version 2.0.0. Specifically, the OAuth code omits the RFC 9728 resource field from ResourceServerMetadata and allows discover_oauth_server_via_resource_metadata to accept protected-resource metadata without confirming that the returned resource identifier exactly matches the configured MCP server. This flaw enables a malicious MCP server to publish metadata for a different legitimate MCP resource and its authorization server. Consequently, a victim connecting and completing the authorization flow may receive an access token that is valid for the legitimate resource but is sent to the malicious server, which can capture the token and impersonate the victim within the token's scopes. The vulnerability is addressed in version 2.0.0 of the rust-sdk.
Potential Impact
An attacker controlling a malicious MCP server can cause clients to obtain access tokens for legitimate MCP resources and capture these tokens. This allows the attacker to impersonate victims against legitimate MCP resources within the scope of the stolen tokens. The vulnerability impacts confidentiality and integrity by enabling token theft and unauthorized access. There is no indication of availability impact. The CVSS score is 8.2 (high severity), reflecting network attack vector, low complexity, no privileges required, user interaction required, scope change, high confidentiality impact, low integrity impact, and no availability impact.
Mitigation Recommendations
Upgrade to version 2.0.0 or later of the modelcontextprotocol rust-sdk, where this vulnerability is fixed. No other mitigation is indicated or required according to the available data.
CVE-2026-63127: CWE-345: Insufficient Verification of Data Authenticity in modelcontextprotocol rust-sdk
Description
### 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: - 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 `resource` value in the returned metadata document. - Section 3.3: if the `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: ```rust 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 1. Add the `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>>, } ``` 2. Add validation logic after fetching metadata: ```rust 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 ))); } } ``` ### PoC 1. Attacker sets up a malicious MCP server at `fake-mcp.com/mcp`. 2. 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` 3. Victim configures any MCP client using `rmcp` to connect to `fake-mcp.com/mcp`. 4. `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. 5. The victim sees a legitimate authorization prompt and completes the flow. 6. The resulting access token — valid for `real-mcp.com/mcp` — is sent to `fake-mcp.com/mcp` in subsequent requests. 7. The attacker captures the token and can impersonate the victim on `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)
CVSS v3.1
Score 8.2high
Affected software
modelcontextprotocol
rust-sdk
pkg:cargo/github/modelcontextprotocol/rust-sdkRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability arises from insufficient verification of data authenticity in the rmcp crate's OAuth implementation before version 2.0.0. Specifically, the OAuth code omits the RFC 9728 resource field from ResourceServerMetadata and allows discover_oauth_server_via_resource_metadata to accept protected-resource metadata without confirming that the returned resource identifier exactly matches the configured MCP server. This flaw enables a malicious MCP server to publish metadata for a different legitimate MCP resource and its authorization server. Consequently, a victim connecting and completing the authorization flow may receive an access token that is valid for the legitimate resource but is sent to the malicious server, which can capture the token and impersonate the victim within the token's scopes. The vulnerability is addressed in version 2.0.0 of the rust-sdk.
Potential Impact
An attacker controlling a malicious MCP server can cause clients to obtain access tokens for legitimate MCP resources and capture these tokens. This allows the attacker to impersonate victims against legitimate MCP resources within the scope of the stolen tokens. The vulnerability impacts confidentiality and integrity by enabling token theft and unauthorized access. There is no indication of availability impact. The CVSS score is 8.2 (high severity), reflecting network attack vector, low complexity, no privileges required, user interaction required, scope change, high confidentiality impact, low integrity impact, and no availability impact.
Mitigation Recommendations
Upgrade to version 2.0.0 or later of the modelcontextprotocol rust-sdk, where this vulnerability is fixed. No other mitigation is indicated or required according to the available data.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-07-15T16:54:55.816Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 6aaaaf7355bf5e2cf5c3ac6d
Added to database: 09/16/2026, 15:02:11 UTC
Last enriched: 09/16/2026, 15:16:52 UTC
Last updated: 09/17/2026, 02:02:35 UTC
Views: 10
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.