GHSA-c9xm-49cp-xcr9: SSRF

Published Oct 2, 2026
·
Updated

Summary

The rmcp OAuth client accepts a server-controlled resourcemetadata= 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 resourcemetadata="..." 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

extractwwwauthenticateparams() accepts an absolute URL from the server-controlled header:

rust let resourcekey = "resourcemetadata="; while let Some(pos) = headerlowercase[searchoffset..].find(resourcekey) { let globalpos = searchoffset + pos + resourcekey.len(); let valueslice = &header[globalpos..]; if let Some((value, consumed)) = Self::parsenextheadervalue(valueslice) { if let Ok(url) = Url::parse(&value) { params.resourcemetadataurl = Some(url); break; } if let Ok(url) = baseurl.join(&value) { params.resourcemetadataurl = 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.

fetchresourcemetadatafromurl() then performs the GET:

rust let response = match self .httpclient .get(resourcemetadataurl.clone()) .header(HEADERMCPPROTOCOLVERSION, "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 resourcemetadata="http://169.254.169.254/latest/meta-data/"

3. The client parses the resourcemetadata 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 resourcemetadata SSRF returned no open or closed matches. - Public issue search for resourcemetadata 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 resourcemetadata 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 issameorigin(base: &Url, candidate: &Url) -> bool { base.scheme() == candidate.scheme() && base.host() == candidate.host() && base.portorknowndefault() == candidate.portorknowndefault() }

If cross-origin resourcemetadata is required for compatibility, it should be explicitly opted into and protected by private-network blocking.

Affected Software

1 affected componentFixes available
rust/rmcp<2.0.0
2.0.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade rust/rmcp to a version that resolves this vulnerability.

    Fixed in 2.0.0
  2. Compensating control

    Before accepting or fetching a server-controlled resource_metadata URL, require it to be same-origin with the original MCP server URL by matching scheme, host, and effective port; reject non-HTTP(S) schemes and targets in loopback, link-local, RFC 1918, unique-local IPv6, or known cloud metadata ranges/hostnames. Apply the same validation to redirect targets and any follow-on metadata URLs.

Event History

Oct 2, 2026
Advisory Published
via GitHub·04:12 PM
Data Sourced
via GitHub·04:12 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are most exposed?

Applications that use the rmcp OAuth client to connect to attacker-controlled or untrusted MCP servers are exposed. Impact is greatest when the application can reach internal services, localhost, RFC 1918 address space, or cloud metadata endpoints from its network context.

2

What must an attacker control to trigger the request?

The attacker needs an MCP server that the victim application will contact. That server can respond with a 401 status and a WWW-Authenticate Bearer header containing a resource_metadata URL chosen by the attacker.

3

How can teams look for attempted exploitation?

Review application and outbound network logs for GET requests initiated after a 401 authentication response, especially requests to localhost, private IP ranges, internal hostnames, or cloud metadata endpoints. The relevant authentication response includes a resource_metadata parameter in the WWW-Authenticate header.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203