Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

fetch: SSRF guard misses RFC 6052 Well-Known NAT64 prefix (64:ff9b::/96) and ::/96

未关闭 适合新手
#5,181 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
75/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend, security

调研方向

从src/fetch/src/mcp_server_fetch/server.py开始,阅读_NON_PUBLIC_NETWORKS和_is_public_address()。检查现有的IPv4-mapped和Local-Use NAT64条目是如何测试的,然后为报告的两个前缀及其嵌入的私有IPv4地址补充测试。完成标准是这些地址会被拒绝,同时公共目标仍保持预期行为。

由索引模型根据 Issue 内容生成。

描述

bug server-fetch v2
Which server?

fetch (mcp-server-fetch)

Server version

latest (post PR #5033 / v2/main)

How did you run the server?

uvx or pip (PyPI package)

Transport

stdio

Protocol era

Modern (2026-07-28)

MCP client and version

Claude Desktop / MCP Inspector

Operating system and runtime

Linux / macOS / Windows, Python 3.10+

Steps to reproduce

Following the merge of PR #5033 ("fix(fetch): refuse private, loopback and metadata addresses by default (#4838)"), _is_public_address() in src/fetch/src/mcp_server_fetch/server.py checks IP addresses against _NON_PUBLIC_NETWORKS.

  1. Start mcp-server-fetch.
  2. Request fetching a target whose resolved IPv6 address maps to an internal IPv4 address using RFC 6052 Well-Known Prefix NAT64 (64:ff9b::/96) or deprecated IPv4-compatible IPv6 (::/96, RFC 4291).
    Examples:
    • 64:ff9b::127.0.0.1 (hex 64:ff9b::7f00:1)
    • 64:ff9b::169.254.169.254 (hex 64:ff9b::a9fe:a9fe)
    • ::127.0.0.1
  3. _is_public_address(ipaddress.ip_address("64:ff9b::127.0.0.1")) is evaluated.
Expected behavior

Under defense-in-depth egress filtering, addresses that translate/embed loopback, RFC 1918, link-local, or cloud metadata IPv4 addresses should be rejected by default, in the same manner as IPv4-mapped IPv6 (::ffff:0:0/96) and Local-Use NAT64 (64:ff9b:1::/48).

Actual behavior

In src/fetch/src/mcp_server_fetch/server.py, _NON_PUBLIC_NETWORKS includes:

  • ipaddress.ip_network("64:ff9b:1::/48") (RFC 8215 Local-Use IPv4/IPv6 Translation)
  • ipaddress.ip_network("::ffff:0:0/96") (RFC 4291 IPv4-mapped IPv6)

However, it omits:

  1. 64:ff9b::/96 (RFC 6052 Well-Known Prefix for IPv4/IPv6 translation)
  2. ::/96 (RFC 4291 IPv4-compatible IPv6)

Because standard Python ipaddress.IPv6Address("64:ff9b::127.0.0.1").is_global evaluates to True, _is_public_address() returns True, allowing the request to bypass the private destination refusal guard in dual-stack / NAT64 environments.

Logs or error output
>>> import ipaddress
>>> from mcp_server_fetch.server import _is_public_address
>>> 
>>> # Currently blocked:
>>> _is_public_address(ipaddress.ip_address("127.0.0.1"))
False
>>> _is_public_address(ipaddress.ip_address("::ffff:127.0.0.1"))
False
>>> 
>>> # Currently bypasses filter:
>>> _is_public_address(ipaddress.ip_address("64:ff9b::127.0.0.1"))
True
>>> _is_public_address(ipaddress.ip_address("64:ff9b::169.254.169.254"))
True
>>> _is_public_address(ipaddress.ip_address("::127.0.0.1"))
True
Already prototyped a fix?

Add both prefixes to _NON_PUBLIC_NETWORKS in src/fetch/src/mcp_server_fetch/server.py:

_NON_PUBLIC_NETWORKS: tuple[ipaddress.IPv4Network | ipaddress.IPv6Network, ...] = (
    # ... existing networks ...
    ipaddress.ip_network("64:ff9b::/96"),  # Well-Known NAT64 Prefix (RFC 6052)
    ipaddress.ip_network("64:ff9b:1::/48"),  # Local-Use IPv4/IPv6 Translation (RFC 8215)
    ipaddress.ip_network("::ffff:0:0/96"),  # IPv4-mapped IPv6 (RFC 4291)
    ipaddress.ip_network("::/96"),  # IPv4-compatible IPv6 (RFC 4291)
)

(Or inspect the embedded 32-bit IPv4 address for any address falling into /96 translation scopes to re-verify against IPv4 private definitions).

Before you submit
  • I searched existing issues and this is not a duplicate.
  • This is not a security vulnerability report (those go through the private advisory form).
主要语言
TypeScript
星标
91.4k
派生
11.8k
平均合并
7 小时 36 分钟
30 天内合并 PR
126

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/servers 的其他 Issue

查看 modelcontextprotocol/servers 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。