Skip to content

AAK-TAINT-006: Tool parameter flows to deserialization

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

What it detects

A @tool function parameter is passed to pickle.loads(), yaml.load(), or similar deserialization functions.

How to fix

Use safe deserialization (yaml.safe_load, json.loads) instead of unsafe alternatives.

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

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

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 pickle.load/loads, yaml.load/unsafe_load and marshal.loads when the 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 (data = blob) is not followed. Other loaders that can run code from the data are not sinks: torch.load, joblib.load and dill.loads are not reported.

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