Skip to content

AAK-TAINT-004: Tool parameter flows to HTTP request

Severity
HIGH
Category
Taint Analysis (taint-analysis)
Scanner
agent_audit_kit/scanners/taint_analysis.py
Auto-fixable
No.
SARIF name
TaintSsrf

What it detects

A @tool function parameter is passed to requests.get/post or urllib, enabling SSRF attacks.

How to fix

Validate the URL against a host allowlist and refuse internal and private addresses, then give the validated value to the request through a call or a new name, such as requests.get(checked_url(url)). The rule fires whenever a tool parameter is passed to the HTTP call under its own name, validated or not.

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

agent-audit-kit scan . --rules AAK-TAINT-004

Limitations

Only functions decorated @tool, @mcp.tool, @server.tool, @langchain.tools.tool, @crewai.tool or @autogen.tool, and a low-level @<server>.call_tool() handler, are analysed, so a FastMCP instance under another name (@app.tool()) is skipped. Reports requests.get/post/put/delete, httpx.get/post and urllib.request.urlopen, written that way or imported under another name (from urllib.request import urlopen), when the URL is not a literal and an argument is a parameter, an item read from one or, in a call_tool handler, a local holding one at most two assignments away. A local in a @tool function (target = url) is not followed. An imported name the file also binds some other way anywhere, a method included (def get(self, key) in an unrelated class silences from requests import get), and every name in a file with a star import, is matched by its spelling only. A client instance (await client.get(url) on an httpx.AsyncClient) and requests.request("GET", url) are not matched.

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