Skip to content

AAK-DNS-REBIND-001: MCP StreamableHTTP transport without Host-header allow-list

Severity
CRITICAL
Category
Transport Security (transport-security)
Scanner
agent_audit_kit/scanners/dns_rebind.py
Auto-fixable
No.
SARIF name
McpStreamableHttpDnsRebind

What it detects

The upstream MCP Python, Java, Apollo and TypeScript SDKs shipped a StreamableHTTP transport that trusts the browser-supplied Host header. A malicious web page that a user visits can resolve a custom domain to 127.0.0.1 via DNS rebinding and reach a local MCP server, turning every browser tab into a remote-attack surface for stdio-grade tools. The upstream patch adds a Host allow-list; downstream servers embedding StreamableHTTP must enforce one too. See CVE-2025-66414 / CVE-2025-66416 (Python), CVE-2026-35568 (Java), CVE-2026-35577 (Apollo), CVE-2026-81102 (Python FastMCP), and CVE-2026-77363, a downstream server (obsidian-tc before 1.3.1) whose TypeScript transport checked neither Host nor Origin. Detection reads the raw SDK transport classes and, since v0.3.93, the Python FastMCP wrapper when it is told to run over a network transport (run(transport="streamable-http"/"sse"), streamable_http_app(), sse_app()). stdio FastMCP servers are deliberately not flagged: FastMCP defaults to stdio and a stdio server has no listener to rebind onto. A loopback host clears this rule for one shape only: the SDK's own FastMCP or 2.x MCPServer, when the project resolves mcp to 1.23.0 or later, the release that turned the protection on for a loopback host when no transport_security is passed. CVE-2026-81102 was loopback-bound on mcp 1.15.0, so below that it fires, and without a readable version it fires and says what would clear it. enable_dns_rebinding_protection=False beside a transport fires whatever allow-list sits next to it, since the SDK ignores the list then, and an allow-list whose only entry is * does not count. Single-file pattern detection with a project-wide mitigation check: one allow-list anywhere in the tree clears every candidate, so a server whose middleware lives in a separate package that is not scanned together will read as mitigated.

How to fix

Wrap the StreamableHTTP app with a Host-header allow-list. In Starlette / FastAPI attach TrustedHostMiddleware(allowed_hosts=...); in Node attach an allowedHosts: option or a Host middleware; in Java/Apollo enable HostHeaderFilter / allowedHosts config. In Python FastMCP pass transport_security=TransportSecuritySettings(allowed_hosts=[...]) when constructing the server, or run it over stdio. On the default loopback host, lock mcp to 1.23.0 or later, which turns the protection on for you. Code that builds StreamableHTTPSessionManager, StreamableHTTPServerTransport or SseServerTransport directly must pass security_settings= itself, even on localhost. Alternatively upgrade the SDK to a patched version and pass through its host-validation option.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-DNS-REBIND-001

Limitations

A candidate is a .py, .ts, .tsx, .js, .mjs or .cjs file that builds a StreamableHTTP transport or a Python SseServerTransport, or a Python FastMCP server, or the SDK's own 2.x MCPServer, run over a network transport. One Host allow-list anywhere in the project clears every candidate, whatever it protects: a Django ALLOWED_HOSTS in an unrelated app counts, and so does a list that holds * beside other names. The exception is enable_dns_rebinding_protection=False (or TypeScript's enableDnsRebindingProtection: false) in the transport's own file; the same setting in another file is not read. The loopback stand-down follows the SDK maintainer's account in modelcontextprotocol/python-sdk issue 3562 and GHSA-9h52-p55h-vw2f: it applies to the SDK's own server on the default or a literal 127.0.0.1, localhost or ::1 host, with no transport_security=, and mcp read from the nearest uv.lock, poetry.lock or Pipfile.lock, else a pin or a range whose every release is 1.23.0 or later in requirements*.txt or pyproject.toml, walking from the file's directory to the root. Any host= in the file is read as the listener's, so uvicorn.run(app, host="0.0.0.0") keeps the finding though the app's own check is on. The standalone fastmcp package never stands down, since its defaults were not read. A manifest over 2 MB, or a source file over 512 KB, is not read.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-DNS-REBIND-001.md: the page then shows that text, with the registry reference appended under it.