Skip to content

fetch: private-address guard bypass via IDNA hostnames (check and connect resolve different names)

This report was submitted with AI assistance

Moderate
cliffhall published GHSA-v38p-wf49-hx2j Oct 25, 2026

Package

pip mcp-server-fetch (pip)

Affected versions

>= 2026.10.10, <= 2026.10.19

Patched versions

2026.10.24

Description

Summary

The private-address guard added in mcp-server-fetch 2026.10.10 checks a different hostname than
the one httpx connects to when the URL has an internationalized (IDNA) host: the guard resolves the
IDNA 2003 form (faß becomes fass) while httpx connects to the IDNA 2008 form (xn--fa-hia).
Anyone who controls a domain can point the two names at a public and an internal address and reach
loopback, private-network or cloud-metadata endpoints through the fetch tool in its default
configuration, which the README says refuses those addresses. Severity: CVSS 4.0 6.3 (Medium); the
CVSS 3.1 equivalent is 7.4 (High).

Details

mcp-server-fetch 2026.10.10 added a guard that refuses loopback, private, link-local and cloud
metadata addresses by default (PR #5033, the fix for the SSRF tracked as CVE-2026-104120). The guard
is an httpx request hook, _refuse_private_destination, which resolves request.url.host with
getaddrinfo and refuses the request if any address is not public
(src/fetch/src/mcp_server_fetch/server.py L119-L143 at tag v1.0.0,
c003d0d807409b22fa640d1f8e11f38f15755721, which is the published 2026.10.10 code). The fetch README
states that by default the server refuses non-public addresses, including cloud metadata endpoints,
and lists two limits: DNS rebinding between the check and the connection, and hostnames the server
cannot resolve itself (proxy-only names). The issue below is neither. It is still present on the
development line (v2/main at 6d613ecff7d320e0e0414a997f46bc4b3367c50d, server.py L140-L154).

For an internationalized hostname the hook and the connection resolve different names:

  • httpx stores the host IDNA 2008 encoded (URL.raw_host, e.g. xn--fa-hia.attacker.example) and
    connects to that name.
  • URL.host, which the hook passes to getaddrinfo, is the decoded Unicode form
    (faß.attacker.example). CPython's socket.getaddrinfo encodes a Unicode name with the built-in
    idna codec, which is IDNA 2003 and maps ß to ss, so the hook looks up
    fass.attacker.example.

The domain owner points fass. at any public address and xn--fa-hia. at an internal one. The hook
approves the public answer and httpx connects to the internal address. There is no timing involved,
so this is separate from the documented DNS-rebinding limit.

The same mismatch also reaches the documented proxy-only branch (L130-L133, which skips the check
when the hook's lookup fails) for a name the server does resolve: if the IDNA 2003 name does not
exist, the hook skips the check, and httpx resolves the IDNA 2008 name itself and connects directly,
with no proxy configured. The fix below covers both.

Both apply to the URL the model passes to the fetch tool and to every redirect hop, since all of
them go through the same hook. ß is one example; final sigma ς gives the same split (σοφος is
xn--0xaajbq for the connector and xn--0xaakcn for the hook). Characters that httpx's IDNA 2008
encoder rejects (ZWJ/ZWNJ, compatibility forms such as Ⅳ or fi) cannot be used.

Suggested fix: resolve and check the exact name the connection uses,
request.url.raw_host.decode("ascii") instead of request.url.host, and treat a resolution failure
as a refusal unless a proxy is configured. Doing the check inside the transport (resolve once,
connect to the checked address) would also close the documented DNS-rebinding gap.

Proof of concept

Reproduction:

  1. In a DNS zone you control, create fass.<zone> with any public A record and
    xn--fa-hia.<zone> with an internal A record (I used 127.0.0.1, standing in for an internal or
    metadata endpoint). Optionally leave fass.nx.<zone> undefined and create
    xn--fa-hia.nx.<zone> -> 127.0.0.1 to see the proxy-only branch reached without a proxy.
  2. Run an HTTP service on the internal address (I used a stub on 127.0.0.1:80 that returns a canary
    JSON for /latest/meta-data/...).
  3. Start mcp-server-fetch 2026.10.10 as python -m mcp_server_fetch with no arguments (no
    --allow-private-ips, no --proxy-url) and no relevant environment variables, so the guard is on.
    Client: the MCP Python SDK 1.30.0 (ClientSession.call_tool) over stdio.
  4. Call the fetch tool with http://xn--fa-hia.<zone>/latest/meta-data/... (or the Unicode form
    http://faß.<zone>/...). The internal service's response comes back as the tool result.
    The same request with a plain name resolving to 127.0.0.1, or with http://127.0.0.1/..., is
    refused by the guard.

My run, in one disposable python:3.12-slim container with a toy DNS server on 127.0.0.1:53 and the
stub on 127.0.0.1:80 (nothing outside the container contacted after installing the package).
Versions: Python 3.12.15, mcp-server-fetch 2026.10.10, httpx 0.28.1, idna 3.20, mcp 1.30.0. The real
server was driven over stdio with the MCP Python client, calling fetch with raw: true:

URL Result
http://127.0.0.1/latest/meta-data/... refused: "127.0.0.1 resolves to 127.0.0.1, which is not a public address"
http://direct.attacker.test/latest/meta-data/... refused (resolves to 127.0.0.1)
http://xn--fa-hia.attacker.test/latest/meta-data/... returned the internal service's response ({"AccessKeyId": "ASIA-POC-CANARY", ...})
http://faß.attacker.test/latest/meta-data/... returned the internal response
http://xn--fa-hia.nx.attacker.test/latest/meta-data/... returned the internal response (hook lookup NXDOMAIN; the server itself resolved and connected to the IDNA 2008 name, no proxy)

The internal service logged the requests with Host: xn--fa-hia.attacker.test and
Host: xn--fa-hia.nx.attacker.test, including the robots.txt check, which takes the same path.

Root cause in three lines:

import httpx
u = httpx.URL("http://xn--fa-hia.attacker.test/")
print(u.host, u.raw_host, u.host.encode("idna"))
# faß.attacker.test b'xn--fa-hia.attacker.test' b'fass.attacker.test'

I can share the full container script (DNS server, stub service, MCP client) if it helps.

Impact

Server-side request forgery (CWE-918) through a bypass of the default egress guard. Affected: anyone
running mcp-server-fetch 2026.10.10 with default settings, typically as a tool for an AI agent. The
guard exists to stop a model-supplied URL, for example one planted by prompt injection in fetched
content, from reaching loopback services, RFC 1918 hosts and cloud metadata endpoints from the
machine running the server. With this bypass an attacker who controls any domain gets that access
back, and the response is returned to the model, so it can be read or passed on.

Limits: the attacker needs the model to fetch an attacker URL (prompt injection or a user request);
what is reachable depends on where the server runs; I tested a loopback service standing in for a
metadata endpoint.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v4 base metrics

Exploitability Metrics
Attack Vector Network
Attack Complexity Low
Attack Requirements None
Privileges Required None
User interaction Passive
Vulnerable System Impact Metrics
Confidentiality None
Integrity None
Availability None
Subsequent System Impact Metrics
Confidentiality High
Integrity None
Availability None

CVSS v4 base metrics

Exploitability Metrics
Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity.
Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system.
Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system.
Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack.
User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner.
Vulnerable System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
Subsequent System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:H/SI:N/SA:N

CVE ID

No known CVE

Weaknesses

Server-Side Request Forgery

The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. Learn more on MITRE.

Credits