rmcp OAuth client does not validate resource_metadata URL, has SSRF vulnerability
rmcp OAuth client fetches server-controlled resource_metadata URLs
A GitHub security advisory discloses an SSRF vulnerability in the rmcp crate of modelcontextprotocol/rust-sdk, with the affected file being crates/rmcp/src/transport/auth.rs. Its OAuth client parses the absolute URL of resource_metadata= from the WWW-Authenticate header returned by the server and directly makes a GET request, without validating whether it is same-origin with the original MCP server or blocking loopback, link-local, RFC 1918 addresses, or cloud metadata endpoints. An attacker-controlled MCP server can return a 401 with a header pointing to internal addresses such as http://169.254.169.254/latest/meta-data/, causing the victim application to probe cloud metadata, localhost services, private VPC or container network services, and internal HTTP APIs using its network context.
披露了 rmcp OAuth 客户端未校验 resource_metadata URL 导致的 SSRF,并给出同源校验与私网拦截的修复思路。