Summary
OpenClaw's streamable-http MCP servers may leak operator-configured custom headers by forwarding them during cross-origin redirects.
If an attacker controls or compromises an MCP endpoint, they can trigger redirects that exfiltrate sensitive headers such as API keys or tenant-routing tokens to attacker-controlled origins.
Affected context
This vulnerability appears in OpenClaw deployments using streamable-http MCP servers where:
- Operators configure custom HTTP headers for backend or tenant routing
- MCP endpoints are allowed to issue HTTP redirects, including cross-origin redirects
- Downstream clients or infrastructure follow redirects automatically
The risk is most pronounced when these headers carry secrets such as API keys, bearer tokens, or internal routing identifiers that are intended only for trusted origins.
Exploit preconditions
- Attack surface: Streamable-http MCP endpoints that accept or broker HTTP requests
- Required access: Ability to control or compromise an MCP endpoint or response path (e.g., run a malicious MCP service or inject redirect responses)
- Trigger point: Issuing an HTTP redirect (e.g., 302, 307) to an attacker-controlled domain while the server forwards operator-configured headers
- Why exploitation is possible: The MCP server does not differentiate between same-origin and cross-origin redirects when forwarding custom headers, causing sensitive headers to be sent to untrusted destinations
Why this happens
The core issue is improper handling of sensitive headers in the presence of redirects.
OpenClaw's streamable-http MCP servers forward operator-configured custom headers blindly, including across origin boundaries, instead of scoping them to intended targets or stripping them on redirects.
This maps to CWE-522: Insufficiently Protected Credentials, because secrets placed in HTTP headers are not adequately constrained or protected from unintended exposure when redirects occur.
Potential impact
- Leakage of API keys, bearer tokens, or other authentication credentials to attacker-controlled origins
- Exposure of tenant-routing or internal routing headers that could enable cross-tenant data access
- Facilitation of account takeover or service impersonation if stolen credentials are reusable
- Increased blast radius if exposed headers grant access to downstream services or internal control planes
General mitigation guidance
Mitigation generally centers around scoping and sanitizing sensitive headers and reducing implicit trust in redirect behavior.
Useful defensive patterns include:
- Limiting which headers are ever treated as secrets and avoiding long-lived credentials in custom headers
- Stripping or selectively forwarding custom headers on redirects, especially when the redirect crosses origins or trust boundaries
- Binding headers that carry secrets to specific hosts, schemes, or paths and dropping them when the target changes
- Using short-lived, least-privilege tokens rather than static API keys for MCP communication
- Enforcing explicit allowlists for outbound destinations from MCP servers to reduce exfiltration paths
How teams detect issues like this
Detection approaches can focus on both configuration and runtime behavior:
- Reviewing MCP server configurations for headers that contain secrets or tokens and verifying how they behave on redirects
- Using static analysis or policy-as-code checks to flag code paths that forward headers during redirects without origin checks
- Instrumenting HTTP logs to capture redirect chains and identify cases where sensitive headers are sent to unfamiliar or external domains
- Employing security scanners or automated tests that simulate malicious MCP endpoints issuing redirects and verifying whether secrets are exposed

