Skip to content

AAK-TOXICFLOW-001

Toxic flow: sensitive source paired with external sink

Field Value
Severity HIGH
Category TOOL_POISONING
Shipped v0.3.5 (2026-04-25) — feature-flagged
Scanner agent_audit_kit/scanners/toxic_flow.py
Data agent_audit_kit/data/toxic_flow_pairs.yml
OWASP MCP none
OWASP Agentic ASI02 (Tool Misuse and Exploitation)
AICM AIS-12, CCC-08
Origin Snyk Agent Scan parity

Feature-flag status

This rule is off by default. Set AAK_TOXIC_FLOW=1 in the environment to opt in. It pairs sources and sinks from a static list, so it over-reports on a project that legitimately does both; the deny-graph design review that would replace the list has not happened.

What it catches

An agent project exposes both a sensitive source tool (filesystem read, secrets read, database query) and an external sink tool (HTTP POST, email send, git push, shell exec). Even if each tool is individually safe, the LLM can chain them — the canonical exfiltration pattern is read_file -> http.post.

The scanner builds a per-scan tool graph from:

  • MCP server names + arg strings in .mcp.json / .cursor/mcp.json / .vscode/mcp.json / .amazonq/mcp.json / mcp.json
  • Function names of @tool / @mcp.tool / @server.tool decorated Python functions in the repo, bare or with empty parentheses

A pair is reported against the config that declared its first configured tool or, when every tool in it is a repo function, at the def of its first tool.

Tool identifiers are matched against agent_audit_kit/data/toxic_flow_pairs.yml which lists known source families (fs_read, secrets_read, db_query) and sink families (http_post, email_send, git_push, shell_exec) plus the pairs that fire.

Suppression

Add the source/sink pair to .aak-toxic-flow-trust.yml with a non-empty justification::

trust:
  - source: fs_read
    sink: http_post
    justification: "Documented data-export feature; sink is allow-listed in egress proxy."

A trust entry without a justification does not suppress (we want the audit trail to carry the reason, not just the decision).

What it does NOT catch

  • Implicit toxic flows where the LLM bridges two non-tool capabilities (e.g. system-prompt context + a shell pipe). Prompt-level controls belong elsewhere.
  • Pairs not yet enumerated in toxic_flow_pairs.yml. Submit a PR with the new family + cite the canonical incident.
  • Tools declared in other languages (TS / Java / Rust): only Python decorators are read.

Remediation

Three knobs, in priority order:

  1. Remove the pairing. Drop the source or the sink if the agent does not actually need both at once.
  2. Scope the source. Restrict fs_read / db_query to a directory or schema the sink cannot reach.
  3. Allow-list with justification. Add the pair to .aak-toxic-flow-trust.yml and document the egress controls that make the chain safe.

Registry reference

This section is generated from the rule registry (agent_audit_kit/rules/builtin.py) when the documentation is built, so it follows the scanner. The rest of the page is hand-written; where the two disagree, the registry is what runs.

Severity
HIGH
Category
Tool Poisoning (tool-poisoning)
Scanner
agent_audit_kit/scanners/toxic_flow.py
Auto-fixable
No.
SARIF name
ToxicFlowSourceSink

What it detects

An agent project exposes both a sensitive source tool (filesystem read, secrets read, database query) and an external sink tool (HTTP POST, email send, git push) without an explicit .aak-toxic-flow-trust.yml allow-list entry. Even if each tool is individually safe, the LLM can chain them — the canonical exfil pattern is read_file -> http.post. Suppress with an allow-list when the pairing is a documented product feature.

How to fix

Add the source/sink pair to .aak-toxic-flow-trust.yml with a justification: field, scope the source tool to a directory the sink cannot reach, or remove one side of the pair. The finding's evidence names the families and the tools on each side.

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

agent-audit-kit scan . --rules AAK-TOXICFLOW-001

Limitations

Off unless AAK_TOXIC_FLOW=1 is in the environment. It reads the server names and args strings of .mcp.json, .cursor/mcp.json, .vscode/mcp.json, .amazonq/mcp.json and mcp.json at the scan root, and the names of Python functions decorated @tool, @mcp.tool or @server.tool with no arguments, and matches each against the names in toxic_flow_pairs.yml. A server is judged by its name and arguments, not by the tools it lists at run time, so @modelcontextprotocol/server-filesystem, whose read tool is read_text_file, is no source. A decorator with arguments (@tool("read_file"), @mcp.tool(name=...)), a TypeScript server.tool(...) and a skill under .claude/skills/ declare no tool. A Python file over 512 KB, or an MCP config or trust file over 1 MB, is not read.

References


All rules.