GHSA-c9xm-49cp-xcr9: rmcp OAuth client fetches server-controlled resource_metadata URLs
The rmcp Rust MCP SDK's OAuth client fetches whatever resource_metadata URL an MCP server puts in its 401 WWW-Authenticate header, with no same-origin or private-network check. A malicious or compromised MCP server can make the client send a GET to localhost, private networks or cloud metadata. Upgrade rmcp to 2.0.0.
Published Oct 2, 2026 · Analysis Oct 30, 2026
What an attacker can do
During OAuth discovery, extract_www_authenticate_params() in crates/rmcp/src/transport/auth.rs parses the resource_metadata value as an absolute URL, or joins it to the base URL. fetch_resource_metadata_from_url() then sends a GET to it. Nothing checks the origin, scheme, host, DNS result or IP range.
An attacker runs an MCP server, or controls a compromised one, and answers discovery with:
WWW-Authenticate: Bearer resource_metadata="http://169.254.169.254/latest/meta-data/"The client then makes the request from the victim application's network position. That reaches cloud metadata endpoints, localhost-only services, private VPC and container networks, and internal HTTP APIs. If the target returns JSON in the expected metadata shape, the flow can chain into further authorization-server metadata fetches.
The victim only needs to connect to the attacker's server. The CVSS 4.0 vector shows low confidentiality impact and attack requirements, so it is mostly useful for probing and for reading JSON-shaped responses. The advisory frames severity as medium to high, depending on where the embedding application runs.
Who is affected
The rmcp crate below 2.0.0. The report reviewed main at commit c330fede (2026-05-19). Applications are exposed if they use the rmcp OAuth client against MCP servers they do not fully control. Check your lockfile and dependency tree:
cargo tree -i rmcpstdio-only clients never run the HTTP OAuth discovery path.
rmcp
- Ecosystem
- Rust (crates.io)
- Affected
- < 2.0.0
- Fixed in
- 2.0.0
- Check
cargo tree -i rmcp
How to fix it
Upgrade to rmcp 2.0.0:
cargo update -p rmcp --precise 2.0.0Pull request #935 limits protected-resource metadata URLs to the same origin as the MCP server, rejects discovered authorization server URLs that point at private addresses or metadata hosts, and follows discovery redirects only within the same origin. The PR adds no setting. A rejected URL appears as a warning in the logs, for example a resource metadata URL rejected as not same-origin with the base URL.
The PR page also lists a later merged change, #1302, titled "allow cross-origin resource_metadata urls". I did not read it, so check how it changes this behavior in your version. The advisory names no workaround. Until you upgrade, connect the client only to MCP servers you trust and restrict egress from the host.
How to tell if you were hit
On patched versions, look in your application logs for warnings about a resource_metadata URL rejected as not same-origin or an authorization server blocked. These show someone tried it. On older versions, review egress and proxy logs for requests from the process to 169.254.169.254, loopback or RFC 1918 addresses that follow a 401 from an MCP server. Review which MCP servers the client contacted just before. Capture the 401 responses if you can and look for a WWW-Authenticate header whose resource_metadata points to a different host. An agent host that records MCP tool calls, as Beam does, shows which servers were in use.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
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
mainreviewed: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:
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:
let response = match self
.http_client
.get(resource_metadata_url.clone())
.header(HEADER_MCP_PROTOCOL_VERSION, "2024-11-05")
.send()
.awaitAgain, there is no same-origin, scheme, host, DNS, or IP-range validation before the request.
Attack scenario
- A Rust MCP client using
rmcpconnects to an attacker-controlled MCP server, or to a compromised MCP server. - The server responds to OAuth discovery with a
401and aWWW-Authenticateheader such as:
WWW-Authenticate: Bearer resource_metadata="http://169.254.169.254/latest/meta-data/"- The client parses the
resource_metadatavalue as a URL. - 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 SSRFreturned no open or closed matches. - Public issue search for
resource_metadatareturned 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:
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.
Questions
- Does this need a malicious MCP server?
Yes, or a compromised one. The attacker needs the victim client to connect to a server that returns the crafted 401 header. No other access is needed.
- Which rmcp version fixes it?
rmcp 2.0.0. Everything below it is listed as vulnerable. The fix is in pull request #935.
- Can the attacker read the response from the internal URL?
Only partly. The client parses the response as OAuth metadata, so JSON of that shape can be used and may chain into more fetches. Otherwise the attacker mostly learns whether a request succeeded or failed.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More MCP Rust SDK (rmcp) vulnerabilities
All MCP Rust SDK (rmcp) entriesCVE-2026-64684
RMCP: Custom HTTP headers leak to cross-origin redirect targets
medium6.8Sep 17, 2026CVE-2026-63127
RMCP: Missing Resource Field Validation in OAuth Protected Resource Metadata Discovery
high8.2Sep 16, 2026CVE-2026-63128
RMCP: Unauthenticated permanent session-table leak in rmcp Streamable HTTP server transport leads to remote denial-of-service
high7.5Sep 16, 2026CVE-2026-42559
rmcp Streamable HTTP server transport has a DNS rebinding vulnerability
high8.8May 6, 2026
