PT-2026-110865
Published
2026-10-02
·
Updated
2026-10-02
Description by
CVSS 4.0
6.3
MediumMetricsAV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
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: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()
.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:
text
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:
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. Found an issue in the description? Have something to add? Feel free to write us 👾