Oct 2, 2026·6 min read·12 visits
The rmcp OAuth client blindly fetches absolute URLs from the resource_metadata parameter in the WWW-Authenticate header of an MCP server response. Attackers can exploit this to perform Server-Side Request Forgery (SSRF), targeting loopback networks, private IP spaces, or cloud metadata endpoints like 169.254.169.254.
A Server-Side Request Forgery (SSRF) vulnerability exists in the rmcp OAuth client, which is part of the Model Context Protocol (MCP) Rust SDK. The vulnerability arises from insecure processing of the resource_metadata parameter in WWW-Authenticate headers returned by a malicious or compromised MCP server. The client parses and fetches absolute URLs from this header without validation of scheme, origin, or network routing, allowing remote attackers to initiate HTTP GET requests to local network interfaces, RFC 1918 private subnets, or cloud metadata endpoints.
The Model Context Protocol (MCP) is an open-standard architecture designed to facilitate secure communication and context exchange between local clients, large language models, and external data services. Within the Rust ecosystem, the rmcp crate provides the key transport layer and OAuth client capabilities to handle server discovery and credential validation routines. This library exposes an authentication-level attack surface during the initial protocol-level handshake sequence.
When a client attempts to connect to an MCP server, it must negotiate access and validate any authentication parameters supplied by the remote endpoint. If the server requires authorization, it initiates an HTTP challenge by returning an HTTP 401 Unauthorized status. The response contains standard WWW-Authenticate header records containing parameters that direct the client to authorization endpoints.
This architecture exposes a trust-boundary vulnerability during the parsing of these challenge records. An attacker who controls or compromises an upstream MCP server can craft response headers to alter the target endpoint configuration. Because the client processes these parameters without validating the destination host, the server can coerce the client application into issuing arbitrary outbound HTTP queries.
The root cause of this vulnerability lies within the header extraction logic implemented in crates/rmcp/src/transport/auth.rs. When parsing the WWW-Authenticate challenge, the client extracts configured variables using the helper function extract_www_authenticate_params(). This function parses string slices to find matching tokens such as the resource_metadata= key value.
Upon isolating the value string, the parser attempts to convert the slice directly into a standard structured format using Url::parse(). If this conversion yields a valid absolute URI containing a scheme prefix such as http:// or https://, the library accepts it directly. The parsed URL is assigned to params.resource_metadata_url without checking if it shares the same host, port, or scheme as the connected MCP server.
After parameter assignment, the library initiates an automated network request to fetch the metadata resource. This execution path invokes the internal reqwest HTTP client inside the fetch_resource_metadata_from_url() function. The client dispatches an HTTP GET request to the parsed address without verifying whether the target resolves to restricted loopbacks, private networks, or internal metadata paths.
An inspection of the vulnerable implementation in crates/rmcp/src/transport/auth.rs shows that absolute URLs were stored directly without validating the target origin:
// Vulnerable Code Path (Pre-v2.0.0)
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) {
// Unvalidated absolute URLs are accepted directly
if let Ok(url) = Url::parse(&value) {
params.resource_metadata_url = Some(url);
break;
}
// Base URL fallback is only used if absolute parsing fails
if let Ok(url) = base_url.join(&value) {
params.resource_metadata_url = Some(url);
break;
}
}
}To mitigate this vulnerability, the fix in version 2.0.0 introduces a strict origin-matching check. The updated parser implements is_same_origin() to ensure that candidate metadata URLs match the core scheme, host, and port of the trusted MCP base URL:
// Patched Same-Origin Check (v2.0.0)
fn is_same_origin(base: &Url, candidate: &Url) -> bool {
base.scheme() == candidate.scheme()
&& base
.host_str()
.zip(candidate.host_str())
.is_some_and(|(base, candidate)| base.eq_ignore_ascii_case(candidate))
&& base.port_or_known_default() == candidate.port_or_known_default()
}
// Applying the protection during extraction
if let Ok(url) = Url::parse(&value) {
if Self::is_same_origin(base_url, &url) {
params.resource_metadata_url = Some(url);
break;
} else {
warn!("rejecting resource metadata URL because it is not same-origin");
}
}Additionally, the patch implements network boundary controls, including private network filters (is_disallowed_metadata_ipv4/ipv6), hostname blocklists for cloud metadata providers, and manual redirect handling. The updated code disables automatic redirects in the HTTP engine by using OAuthHttpRedirectPolicy::Stop and manually verifies that subsequent redirections remain within the origin boundaries.
To execute this attack, an adversary must establish a malicious MCP server and convince a vulnerable client application to connect to it. Alternatively, an attacker can compromise a legitimate server and modify its challenge headers. Once the client initiates a connection, the malicious server issues a crafted HTTP 401 Unauthorized challenge.
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="http://169.254.169.254/latest/meta-data/"The client extracts the resource metadata target from the WWW-Authenticate header, parsing it as an absolute URL pointing to the link-local IP of the cloud environment. The client then initiates an outbound HTTP GET query to the target IP, passing the protocol version header.
In environments like AWS, GCP, or Azure, this GET query targets internal systems or local services. Depending on how the application handles the response, the attacker can leverage the request flow to map the internal network infrastructure or retrieve instance credentials.
Although the primary vulnerability in resource_metadata_url is mitigated, the cross-origin authorization discovery pathway in version 2.0.0 remains vulnerable to a DNS resolution bypass. The patched library implements the function is_disallowed_metadata_host() to evaluate if cross-origin endpoints point to restricted addresses.
This logic evaluates host strings against a static blocklist of names like localhost or metadata. If the host string is a domain name rather than a raw IP, it bypasses the IP range check function, which returns false and allows the URL configuration to pass.
match host.parse::<IpAddr>() {
Ok(IpAddr::V4(addr)) => Self::is_disallowed_metadata_ipv4(addr),
Ok(IpAddr::V6(addr)) => Self::is_disallowed_metadata_ipv6(addr),
Err(_) => false, // Default fallback allows the domain name configuration
}This pattern allows attackers to bypass controls using DNS pointer redirection. An attacker can map a custom public domain name to a loopback address or a private network address. Because the client library evaluates the host string before DNS resolution occurs, it accepts the configuration, allowing the HTTP client to resolve and access the private target during request dispatch.
The primary remediation for this vulnerability is to upgrade the rmcp dependency to version 2.0.0 or newer within the Rust Cargo.toml manifest file.
[dependencies]
rmcp = "2.0.0"Security teams can identify vulnerable instances within their code repositories by executing the cargo audit command, which reviews the dependency tree against the advisory database. Organizations can also use security scanning rules to verify if application clients remain vulnerable to absolute URL challenges:
id: rmcp-oauth-ssrf-detection
info:
name: Model Context Protocol rmcp Client SSRF Detection
author: Security Research Team
severity: medium
classification:
cwe-id: CWE-918
http:
- raw:
- |
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer error="invalid_token", resource_metadata="http://{{interactsh-url}}/.well-known/oauth-protected-resource"
matchers:
- type: word
part: interactsh_protocol
words:
- "http"To counter DNS bypasses, network administrators should implement system-level egress firewall rules. Blocking traffic from the client container to AWS metadata ranges and RFC 1918 subnets prevents exploitation regardless of domain mapping techniques.
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| Product | Affected Versions | Fixed Version |
|---|---|---|
rmcp modelcontextprotocol | < 2.0.0 | 2.0.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-918 |
| Attack Vector | Network |
| CVSS Score | 6.3 |
| Exploit Status | poc |
| CISA KEV Status | Not Listed |
| Impact | Information Disclosure / Server-Side Request Forgery |
The web server receives a URL or similar request from an upstream server or client and retrieves the resource without sufficiently validating the destination, allowing the attacker to coerce the server into sending requests to unintended locations.
CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.
An operating system command injection vulnerability (CWE-78) exists in GeoNode versions prior to 5.1.0. The vulnerability occurs in the vector upload processing pipeline when handling user-supplied geospatial files. By supplying a crafted layer name containing shell metacharacters, an authenticated attacker with basic data upload privileges can execute arbitrary commands on the underlying server or container hosting the GeoNode application and Celery worker processes.
GeoNode versions prior to 5.0.3 contain an unrestricted file upload vulnerability (CWE-434) within the document and dataset ingestion architecture. Authenticated low-privileged users can bypass upload validation via direct REST API interactions, file extension masquerading, metadata mutation via PATCH requests, or malicious archive submissions. This allows attackers to store and serve dangerous file types, alter on-disk file references, or trigger path traversal and resource exhaustion during archive extraction.
CVE-2026-55649 is a stored Cross-Site Scripting (XSS) vulnerability in GeoNode versions prior to 5.0.3. The flaw exists because document abstract metadata fields are ingested via the metadata management pipeline and stored in the backend database without HTML sanitization or input neutralization. An authenticated attacker with privileges to create or edit document metadata can inject arbitrary HTML and JavaScript payloads into these fields. When another user, such as an administrator, views the affected document page or catalog listing, the unencoded payload is rendered into the Document Object Model (DOM) and executes within the victim's browser session.
CVE-2026-55622 (GHSA-qx75-2p3r-pwm5) is an improper access control vulnerability (CWE-284) in Canonical LXD and LXC Incus (tracked as GHSA-c9f5-j9c3-mhrg). In multi-tenant deployments utilizing project-based isolation, the REST API handler for instance creation via POST /1.0/instances verifies that the authenticated user has authorization in the destination project specified by the query parameter, but fails to verify whether the user holds read or view permissions for the source instance when executing a copy operation across projects. Consequently, an authenticated client restricted to a single project can clone instances or snapshots from unauthorized projects into their own project, resulting in complete disclosure of the target instance filesystem and embedded credentials.
An authorization bypass vulnerability in Canonical LXD (tracked as GHSA-7mr3-28h5-m5vx and CVE-2026-55621, and as GHSA-64f3-v33m-w89f in Linux Containers Incus) allows an authenticated user with restricted project access to copy custom storage volumes and volume snapshots from unauthorized projects. The flaw resides in the storagePoolVolumesPost REST API handler, which verifies permissions on the destination project but fails to check whether the caller holds view entitlements on the source project or volume specified in the request body.