Skip to content

rmcp OAuth client fetches server-controlled resource_metadata URLs

Moderate severity GitHub Reviewed Published Jun 29, 2026 in modelcontextprotocol/rust-sdk • Updated Oct 2, 2026

Package

cargo rmcp (Rust)

Affected versions

< 2.0.0

Patched versions

2.0.0

Description

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:

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()
    .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:
WWW-Authenticate: Bearer resource_metadata="http://169.254.169.254/latest/meta-data/"
  1. The client parses the resource_metadata value as a URL.
  2. 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:

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.

References

@DaleSeo DaleSeo published to modelcontextprotocol/rust-sdk Jun 29, 2026
Published to the GitHub Advisory Database Oct 2, 2026
Reviewed Oct 2, 2026
Last updated Oct 2, 2026

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v4 base metrics

Exploitability Metrics
Attack Vector Network
Attack Complexity Low
Attack Requirements Present
Privileges Required None
User interaction None
Vulnerable System Impact Metrics
Confidentiality Low
Integrity None
Availability None
Subsequent System Impact Metrics
Confidentiality None
Integrity None
Availability None

CVSS v4 base metrics

Exploitability Metrics
Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity.
Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system.
Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system.
Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack.
User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner.
Vulnerable System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
Subsequent System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
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

EPSS score

Weaknesses

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. Learn more on MITRE.

CVE ID

No known CVE

GHSA ID

GHSA-c9xm-49cp-xcr9
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.