Skip to content

AAK-MCP-SSRF-001: MCP tool handler fetches a caller-supplied URL without host/scheme allow-list

Severity
MEDIUM
Category
MCP Configuration (mcp-config)
Scanner
agent_audit_kit/scanners/mcp_ssrf_toolarg.py
Auto-fixable
No.
SARIF name
McpToolArgUrlSsrf

What it detects

An MCP tool handler passes an attacker-controllable URL argument (url / endpoint / target / uri and similar) straight into an outbound fetch (requests / httpx / urllib / aiohttp) without validating the host or scheme first, so a caller-supplied URL is fetched server-side and can reach loopback, private-range, or cloud-metadata endpoints (CWE-918, server-side request forgery). NVD, CVE-2026-14748: "A flaw has been found in AIAnytime Awesome-MCP-Server ... the file mcp-wiki/src/mcp_wiki/server.py of the component mcp-wiki/wiki-summary. This manipulation of the argument url causes server-side request forgery. The attack may be initiated remotely. The exploit has been published." (CVSS 6.3 MEDIUM, https://nvd.nist.gov/vuln/detail/CVE-2026-14748).

How to fix

Deny by default: before fetching, parse the URL, require an https scheme, resolve the host, and reject anything not on an explicit host allow-list (also reject RFC 1918, 127.0.0.0/8, 169.254.0.0/16, ::1, fc00::/7). Disable automatic redirects or re-validate every hop, and pin the resolved IP for the actual request to defeat DNS rebinding.

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

agent-audit-kit scan . --rules AAK-MCP-SSRF-001

Limitations

Reads only files that contain FastMCP, McpServer, modelcontextprotocol, createTool, mcp.tool, @tool, @x.tool, .tool(, .registerTool, from mcp, import mcp (each as whole words), mcp.server or mcp_wiki (any case). In Python, a parameter counts as a URL when its name is url, uri, endpoint, target, link, href, webhook or callback, with an optional plural s and one optional alphanumeric prefix joined by an underscore, in any case (page_url, v2_url), so website is not followed. The fetch has to be in the same function, so a handler that passes url to a helper which calls requests.get is missed, and any of ALLOW_HOST(S), ALLOWED_HOST(S), allowlist, allow_list, urlparse, is_private, ip_address, ip_network, validate_url, is_safe_url, check_url, ssrf, deny, scheme [not] in, netloc [not] in, hostname [not] in or startswith("https in the function, in any case, counts as validation, even when its result is only logged.

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-MCP-SSRF-001.md: the page then shows that text, with the registry reference appended under it.