Summary
A server-side request forgery vulnerability in mcp-fetch allows crafted IPv6 literal targets to bypass the component's private-address protections. When a tool argument influences the fetch target, an attacker may cause the service to retrieve internal resources, including cloud metadata or loopback services, and return their responses to the model context.
Affected context
The issue occurs when mcp-fetch validates user- or model-influenced URLs before making outbound HTTP requests. It is relevant to deployments that permit untrusted tool arguments and use IPv6 literals, IPv4-mapped IPv6 addresses, or equivalent representations for internal destinations. The risk is higher when the fetching service can reach loopback interfaces, private network ranges, link-local services, or cloud metadata endpoints.
Exploit preconditions
- Attack surface: The mcp-fetch URL-fetching tool and its outbound HTTP client
- Required access: The attacker must be able to influence, directly or indirectly, the tool argument that supplies the fetch target
- Trigger point: URL validation followed by the outbound request
- Why exploitation is possible: Bracketed IPv6 hostnames are tested as strings that net.isIP does not recognize, causing private-address checks to be skipped; IPv4-mapped IPv6 forms are also not covered by the IPv6 private-address logic
Why this happens
The vulnerability results from inconsistent normalization between URL parsing, SSRF validation, and HTTP connection handling. The validator receives a bracketed IPv6 hostname, fails to classify it as an IP address, and falls back to hostname resolution even though the HTTP client later removes the brackets and connects to the literal address. In addition, the private IPv6 checks do not account for the IPv4-mapped ::ffff: range, allowing addresses representing IPv4 loopback, private, or link-local targets to evade policy. This maps to CWE-918 because attacker-controlled destinations can cause the server to issue requests to restricted internal resources.
Potential impact
- An attacker may read responses from loopback or private network services
- The service could expose cloud or infrastructure metadata
- Internal administrative interfaces may be probed or accessed
- Sensitive internal response data could be placed into the model context
- The vulnerable component could become a pivot point for further attacks
General mitigation guidance
Mitigation generally focuses on canonicalizing the destination before every security decision and applying one consistent address policy to both IPv4 and IPv6. Secure-by-default designs commonly parse and normalize bracketed literals, recognize IPv4-mapped IPv6 addresses, resolve names where required, and validate every resulting address against explicit loopback, private, link-local, multicast, reserved, and metadata-service restrictions. Redirects and subsequent connection destinations should receive the same checks, while DNS rebinding exposure can be reduced through resolution and connection controls. Input trust should be minimized, outbound network access should be restricted with egress policies, and the fetching process should run with least privilege and without access to sensitive local services.
How teams detect issues like this
Detection approaches include static analysis and code review rules that flag SSRF checks performed before canonicalization, direct string comparisons of hostnames, incomplete IPv6 classification, and separate validation and connection parsing paths. Tests should cover bracketed IPv6 literals, IPv4-mapped IPv6 representations, redirects, DNS resolution results, and private or link-local destinations. Runtime monitoring can enforce outbound network policies and alert on requests to loopback, RFC1918, link-local, or metadata-service ranges. Automated security review tools may help identify inconsistent URL parsing and destination validation.

