AAK-SSRF-004: Redirect chains followed without re-validation
- Severity
- HIGH
- Category
- MCP Configuration (
mcp-config) - Scanner
agent_audit_kit/scanners/ssrf_patterns.py- Auto-fixable
- No.
- SARIF name
SsrfRedirectRevalidation
What it detects
An MCP or agent tool fetches a URL the caller can set with a client that follows redirects, by default or by an explicit flag. A check before the call covers only the first hop, so a public URL that answers with a 3xx to an internal address gets past it. DNS rebinding works the same way.
How to fix
Disable automatic redirects, or re-run host validation on every hop. Cap total redirects at 3.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-SSRF-004
Limitations
Reads only files that contain @tool, createTool, McpServer, FastMCP, mcp.tool, Server.run_streamable_http, BaseTool or StructuredTool, or def forward and output_type with a class on a Tool base (a smolagents tool). It fires on an explicit follow_redirects=True, allow_redirects=True or redirect: "follow" in a file with a recognised fetch call, and on a call whose URL the caller can set, read as AAK-SSRF-001 reads it, made with a client that follows by default: requests, urllib.request.urlopen, aiohttp.request or something called session in Python, and every TS/JS client AAK-SSRF-001 recognises. httpx does not follow by default, so httpx.get and something called client count only with the flag. allow_redirects= with anything but a literal True on the call stands it down, and in TS/JS redirect: "manual" or "error", maxRedirects: 0 or .redirects(0) anywhere in the file does. A value handed to a helper that fetches is not followed, a hand-written check of every hop still fires unless it turns redirects off, and a file gets one finding, for the first such call. A call that fires this usually fires AAK-SSRF-001 and AAK-SSRF-005 as well.
References
- OWASP MCP Top 10: MCP05:2025 (Command Injection & Execution)
- OWASP Agentic Top 10: ASI02 (Tool Misuse and Exploitation)
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-SSRF-04
- CSA AI Controls Matrix (AICM): IVS-04
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-SSRF-004.md: the page then shows that text, with the registry reference appended under it.