GHSA-c9xm-49cp-xcr9: Rmcp Remote Code Execution Vulnerability

MODERATE
CWE-918
Published
Advisory Summary

GHSA-c9xm-49cp-xcr9 is a MODERATE remote code execution vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Rmcp libraries in the crates.io ecosystem. The issue involves rmcp oauth client fetches server-controlled resource_metadata urls. Remediation is available by upgrading affected packages to version 2.0.0.

GHSA-c9xm-49cp-xcr9 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-c9xm-49cp-xcr9
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-918: Server-Side Request Forgery (SSRF)
Affected Product Rmcp
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-c9xm-49cp-xcr9

To remediate this vulnerability, upgrade all affected Rmcp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

rmcp fixed: 2.0.0
Upgrade rmcp to 2.0.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for rmcp

How to Check if You Are Affected

To determine whether your application is affected by GHSA-c9xm-49cp-xcr9, inspect your project dependencies for Rmcp:

inspect dependencies for rmcp

Analyze the terminal output to locate any version of Rmcp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. In Rmcp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary The `rmcp` OAuth client accepts a server-controlled `resource_metadata=` URL from the `WWW-Authenticate` header and fetches it without same-origin or private-network validation. An attacker-controlled MCP server can return a `401 WWW-Authenticate: Bearer resource_metadata="..."` header pointing at an internal URL, including localhost, RFC 1918 addresses, or cloud metadata endpoints. The client then performs an outbound GET to that URL from the victim application's network context. ## Affected version - Repository: `modelcontextprotocol/rust-sdk` - Crate: `rmcp` - Current `main` reviewed: `c330fede90e4729c234f8e87fdbc5ea27a1dd10c` - Commit date: 2026-05-19 - Affected file: `crates/rmcp/src/transport/auth.rs` - File blob: `3aa3e91310662c409af9dc38c9d584d6df217e9c` - Severity framing: High/Medium SSRF, depending on the embedding application's network position and whether response parsing gives the attacker useful success/failure or chained fetch behavior. ## Source evidence `extract_www_authenticate_params()` accepts an absolute URL from the server-controlled header: ```rust let resource_key = "resource_metadata="; while let Some(pos) = header_lowercase[search_offset..].find(resource_key) { let global_pos = search_offset + pos + resource_key.len(); let value_slice = &header[global_pos..]; if let Some((value, consumed)) = Self::parse_next_header_value(value_slice) { if let Ok(url) = Url::parse(&value) { params.resource_metadata_url = Some(url); break; } if let Ok(url) = base_url.join(&value) { params.resource_metadata_url = Some(url); break; } ``` There is no check that the parsed URL shares origin with the original MCP server, and no block for loopback, link-local, RFC 1918, or metadata hostnames. `fetch_resource_metadata_from_url()` then performs the GET: ```rust let response = match self .http_client .get(resource_metadata_url.clone()) .header(HEADER_MCP_PROTOCOL_VERSION, "2024-11-05") .send() .await ``` Again, there is no same-origin, scheme, host, DNS, or IP-range validation before the request. ## Attack scenario 1. A Rust MCP client using `rmcp` connects to an attacker-controlled MCP server, or to a compromised MCP server. 2. The server responds to OAuth discovery with a `401` and a `WWW-Authenticate` header such as: ```text WWW-Authenticate: Bearer resource_metadata="http://169.254.169.254/latest/meta-data/" ``` 3. The client parses the `resource_metadata` value as a URL. 4. The client sends a GET request to that URL from the victim application's network context. This can be used to probe internal services. In environments where the target endpoint returns JSON matching the expected metadata shape, the flow can also chain into additional authorization-server metadata fetches. ## Impact The direct impact is SSRF from any application embedding the rmcp OAuth client. Depending on where the client runs, this can reach: - cloud metadata endpoints; - localhost-only services; - private VPC or container-network services; - internal HTTP APIs not reachable from the attacker. The attacker controls the URL through the MCP server response. The victim only needs to connect to the attacker's MCP server or a compromised server that can emit the crafted `WWW-Authenticate` header. ## Public duplicate check On 2026-05-27: - Visible repository advisories were: - `GHSA-9g45-5xwm-f3wc`: custom HTTP headers leak to cross-origin redirect targets. - `GHSA-89vp-x53w-74fx`: DNS rebinding in Streamable HTTP server transport. - Public issue search for `WWW-Authenticate resource_metadata SSRF` returned no open or closed matches. - Public issue search for `resource_metadata` returned one closed implementation issue, `#517`, about authorization discovery fallback behavior, not SSRF/resource validation. This report is distinct from the redirect-header advisory and the DNS-rebinding advisory. ## Suggested fix Before accepting or fetching a `resource_metadata` URL: - require the URL to be same-origin with the original MCP server URL, unless the spec intentionally permits a narrow trusted exception; - reject loopback, link-local, RFC 1918, unique-local IPv6, and known cloud metadata hostnames; - reject non-HTTP(S) schemes; - apply the same validation to redirect targets and any follow-on metadata URLs. A minimal same-origin check would compare scheme, host, and effective port: ```rust fn is_same_origin(base: &Url, candidate: &Url) -> bool { base.scheme() == candidate.scheme() && base.host() == candidate.host() && base.port_or_known_default() == candidate.port_or_known_default() } ``` If cross-origin `resource_metadata` is required for compatibility, it should be explicitly opted into and protected by private-network blocking.

GHSA-c9xm-49cp-xcr9 Affected Rmcp Versions

1 component(s)
Fixed Versions:
2.0.0
Product / Package Ecosystem Affected Versions Fixed Version
rmcp
crates.io
< 2.0.0
2.0.0

References

Frequently Asked Questions

What is GHSA-c9xm-49cp-xcr9?
GHSA-c9xm-49cp-xcr9 is a security vulnerability in Rmcp involving rmcp OAuth client fetches server-controlled resource_metadata URLs under CWE-918: Server-Side Request Forgery (SSRF).
Which Rmcp versions are affected?
Affected versions include releases prior to 2.0.0 across affected packages: rmcp.
What version fixes GHSA-c9xm-49cp-xcr9?
Upgrading to 2.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rmcp affected?
Yes, rmcp is affected in releases prior to 2.0.0. Upgrade your dependency to 2.0.0 or later.
What CWE is associated with GHSA-c9xm-49cp-xcr9?
GHSA-c9xm-49cp-xcr9 is classified under CWE-918: Server-Side Request Forgery (SSRF) (The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.).
How can I check crates.io dependencies for GHSA-c9xm-49cp-xcr9?
Run the dependency tree command: 'inspect dependencies for rmcp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-c9xm-49cp-xcr9",
  "modified" : "2026-10-02T16:12:31Z",
  "published" : "2026-10-02T16:12:31Z",
  "aliases" : [ ],
  "summary" : "rmcp OAuth client fetches server-controlled resource_metadata URLs",
  "details" : "## Summary\n\nThe `rmcp` OAuth client accepts a server-controlled `resource_metadata=` URL from the `WWW-Authenticate` header and fetches it without same-origin or private-network validation.\n\nAn attacker-controlled MCP server can return a `401 WWW-Authenticate: Bearer resource_metadata=\"...\"` header pointing at an internal URL, including localhost, RFC 1918 addresses, or cloud metadata endpoints. The client then performs an outbound GET to that URL from the victim application's network context.\n\n## Affected version\n\n- Repository: `modelcontextprotocol/rust-sdk`\n- Crate: `rmcp`\n- Current `main` reviewed: `c330fede90e4729c234f8e87fdbc5ea27a1dd10c`\n- Commit date: 2026-05-19\n- Affected file: `crates/rmcp/src/transport/auth.rs`\n- File blob: `3aa3e91310662c409af9dc38c9d584d6df217e9c`\n- Severity framing: High/Medium SSRF, depending on the embedding application's network position and whether response parsing gives the attacker useful success/failure or chained fetch behavior.\n\n## Source evidence\n\n`extract_www_authenticate_params()` accepts an absolute URL from the server-controlled header:\n\n```rust\nlet resource_key = \"resource_metadata=\";\nwhile let Some(pos) = header_lowercase[search_offset..].find(resource_key) {\n    let global_pos = search_offset + pos + resource_key.len();\n    let value_slice = &header[global_pos..];\n    if let Some((value, consumed)) = Self::parse_next_header_value(value_slice) {\n        if let Ok(url) = Url::parse(&value) {\n            params.resource_metadata_url = Some(url);\n            break;\n        }\n        if let Ok(url) = base_url.join(&value) {\n            params.resource_metadata_url = Some(url);\n            break;\n        }\n```\n\nThere is no check that the parsed URL shares origin with the original MCP server, and no block for loopback, link-local, RFC 1918, or metadata hostnames.\n\n`fetch_resource_metadata_from_url()` then performs the GET:\n\n```rust\nlet response = match self\n    .http_client\n    .get(resource_metadata_url.clone())\n    .header(HEADER_MCP_PROTOCOL_VERSION, \"2024-11-05\")\n    .send()\n    .await\n```\n\nAgain, there is no same-origin, scheme, host, DNS, or IP-range validation before the request.\n\n## Attack scenario\n\n1. A Rust MCP client using `rmcp` connects to an attacker-controlled MCP server, or to a compromised MCP server.\n2. The server responds to OAuth discovery with a `401` and a `WWW-Authenticate` header such as:\n\n```text\nWWW-Authenticate: Bearer resource_metadata=\"http://169.254.169.254/latest/meta-data/\"\n```\n\n3. The client parses the `resource_metadata` value as a URL.\n4. The client sends a GET request to that URL from the victim application's network context.\n\nThis can be used to probe internal services. In environments where the target endpoint returns JSON matching the expected metadata shape, the flow can also chain into additional authorization-server metadata fetches.\n\n## Impact\n\nThe direct impact is SSRF from any application embedding the rmcp OAuth client. Depending on where the client runs, this can reach:\n\n- cloud metadata endpoints;\n- localhost-only services;\n- private VPC or container-network services;\n- internal HTTP APIs not reachable from the attacker.\n\nThe attacker controls the URL through the MCP server response. The victim only needs to connect to the attacker's MCP server or a compromised server that can emit the crafted `WWW-Authenticate` header.\n\n## Public duplicate check\n\nOn 2026-05-27:\n\n- Visible repository advisories were:\n  - `GHSA-9g45-5xwm-f3wc`: custom HTTP headers leak to cross-origin redirect targets.\n  - `GHSA-89vp-x53w-74fx`: DNS rebinding in Streamable HTTP server transport.\n- Public issue search for `WWW-Authenticate resource_metadata SSRF` returned no open or closed matches.\n- Public issue search for `resource_metadata` returned one closed implementation issue, `#517`, about authorization discovery fallback behavior, not SSRF/resource validation.\n\nThis report is distinct from the redirect-header advisory and the DNS-rebinding advisory.\n\n## Suggested fix\n\nBefore accepting or fetching a `resource_metadata` URL:\n\n- require the URL to be same-origin with the original MCP server URL, unless the spec intentionally permits a narrow trusted exception;\n- reject loopback, link-local, RFC 1918, unique-local IPv6, and known cloud metadata hostnames;\n- reject non-HTTP(S) schemes;\n- apply the same validation to redirect targets and any follow-on metadata URLs.\n\nA minimal same-origin check would compare scheme, host, and effective port:\n\n```rust\nfn is_same_origin(base: &Url, candidate: &Url) -> bool {\n    base.scheme() == candidate.scheme()\n        && base.host() == candidate.host()\n        && base.port_or_known_default() == candidate.port_or_known_default()\n}\n```\n\nIf cross-origin `resource_metadata` is required for compatibility, it should be explicitly opted into and protected by private-network blocking.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "rmcp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/rust-sdk/security/advisories/GHSA-c9xm-49cp-xcr9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/rust-sdk/pull/935"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/rust-sdk/commit/eb435c6f51864df74926ef115befce55c16b01ba"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/modelcontextprotocol/rust-sdk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/modelcontextprotocol/rust-sdk/releases/tag/rmcp-v2.0.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-918" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-02T16:12:31Z",
    "nvd_published_at" : null
  }
}