Summary
RMCP: Custom HTTP headers leak to cross-origin redirect targets
The rmcp crate's StreamableHttpClientTransport forwards caller-supplied custom HTTP headers (such as X-API-Key, X-Auth-Token, Api-Key) to cross-origin redirect targets. The default_http_client() function builds a reqwest::Client without a redirect policy override, so the default limited(10) policy follows 307/308 redirects and forwards all per-request headers except Authorization, Cookie, and Proxy-Authorization. Custom auth headers injected via StreamableHttpClientTransportConfig.custom_headers are not classified as sensitive and are therefore forwarded verbatim to any redirect target, including an attacker-controlled server.
Affected versions
- Repository:
github.com/modelcontextprotocol/rust-sdk - Crate:
rmcp - Commit tested:
c330fede90e4729c234f8e87fdbc5ea27a1dd10c(HEAD, 2026-05-21)
Vulnerability
File: crates/rmcp/src/transport/common/reqwest/streamable_http_client.rs
Root cause 1, no redirect policy override:
// Lines 302-307
fn default_http_client() -> reqwest::Client {
reqwest::Client::builder()
.pool_max_idle_per_host(0)
.build()
.expect("failed to build default reqwest client")
}
No .redirect(reqwest::redirect::Policy::none()) call. The default limited(10) policy follows up to 10 redirects and, on cross-origin redirects, strips only Authorization, Cookie, and Proxy-Authorization.
Root cause 2, custom headers not sensitivity-marked:
// Lines 26-35
fn apply_custom_headers(
mut builder: reqwest::RequestBuilder,
custom_headers: HashMap<HeaderName, HeaderValue>,
) -> Result<reqwest::RequestBuilder, StreamableHttpError<reqwest::Error>> {
for (name, value) in custom_headers {
validate_custom_header(&name).map_err(StreamableHttpError::ReservedHeaderConflict)?;
builder = builder.header(name, value); // no sensitivity marker
}
Ok(builder)
}
Headers added via RequestBuilder::header() are forwarded to redirect targets because reqwest only strips headers from its own sensitive-header list (Authorization, Cookie, Proxy-Authorization).
Exposed API: StreamableHttpClientTransportConfig.custom_headers (line 1070), intended for custom auth headers:
/// Custom HTTP headers to include with every request
pub custom_headers: HashMap<HeaderName, HeaderValue>,
Attack scenario
- A caller sets
custom_headerswith an API key for the MCP server:let config = StreamableHttpClientTransportConfig::with_uri("https://mcp.example.com/mcp") .custom_headers([(HeaderName::from_static("x-api-key"), HeaderValue::from_static("my-secret-key"))].into()); - An attacker compromises
mcp.example.comto return307 Temporary Redirecttohttps://attacker.example.net/capture. rmcpfollows the redirect, forwardingX-API-Key: my-secret-keytoattacker.example.net.- The attacker captures the secret and reuses it to call the MCP server directly.
Negative control
The auth_header path (StreamableHttpClientTransportConfig::auth_header()) sets the value via builder.bearer_auth(auth_header), which maps to the Authorization header, stripped by reqwest on cross-origin redirects. That path is not affected. Only custom_headers is vulnerable.
Impact
CVE-2026-64684 has a CVSS score of 6.8 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.1.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
In default_http_client(), disable automatic redirect following:
fn default_http_client() -> reqwest::Client {
reqwest::Client::builder()
.pool_max_idle_per_host(0)
.redirect(reqwest::redirect::Policy::none()) // <-- add this
.build()
.expect("failed to build default reqwest client")
}
The transport can then inspect 3xx responses and decide whether to follow, stripping sensitive headers before doing so. Alternatively, use reqwest::ClientBuilder::connection_verbose or per-request Request::headers_mut() to remove auth headers before the redirect is followed.
Frequently Asked Questions
- What is CVE-2026-64684? CVE-2026-64684 is a medium-severity security vulnerability in rmcp (rust), affecting versions < 2.1.0. It is fixed in 2.1.0.
- How severe is CVE-2026-64684? CVE-2026-64684 has a CVSS score of 6.8 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of rmcp are affected by CVE-2026-64684? rmcp (rust) versions < 2.1.0 is affected.
- Is there a fix for CVE-2026-64684? Yes. CVE-2026-64684 is fixed in 2.1.0. Upgrade to this version or later.
- Is CVE-2026-64684 exploitable, and should I be worried? Whether CVE-2026-64684 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-64684 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-64684? Upgrade
rmcpto 2.1.0 or later.