Skip to content

AAK-SHELL-QUOTED-INTERP-001: Tool argument interpolated into a shell command, quoting notwithstanding

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

What it detects

An agent/tool parameter reaches a shell-executing sink through an interpolated command string (CWE-78), including via a local variable and including when the interpolation site is quoted. Double quotes are not a mitigation: $(...), backticks and ${...} all expand inside them, so getent passwd "${username}" is exactly as injectable as the unquoted form — that is CVE-2026-55157 (CVSS 3.1 8.4). Single quotes do block substitution but not a literal ' that closes the quoting. The rule also covers the argv-behind-an-eval-flag form: passing a list instead of a shell string stops shell metacharacters, but not injection into an interpreter you explicitly invoked, which is how CVE-2026-55071 (CVSS 3.1 8.4) reached the OS through Stata's own shell escape. In JavaScript and TypeScript it also follows one call into another file: a tool handler passes a tool-argument value to a method defined in another file, and that method interpolates the parameter into the command. That is CVE-2026-94031, where nexus-mcp's nexus_reauth handler handed its url argument to a method that ran open "${loginUrl}" through exec. Narrower and more precise than AAK-TAINT-001, which only matches a bare parameter handed straight to the sink.

How to fix

Do not build the command as a string. Pass an argv list with no shell, and if an element must carry a value, escape it with shlex.quote (Python) or the shell-quote package (Node). Where the argv element is itself a program for an interpreter, validate the value against an allow-list — quoting the outer shell does nothing for the inner one.

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

agent-audit-kit scan . --rules AAK-SHELL-QUOTED-INTERP-001

Limitations

Propagation is one hop: a parameter interpolated into a local variable that is then passed to the sink. In JavaScript and TypeScript it also follows one call from a tool handler into a method defined in another file, matched by name, not type: a same-named method elsewhere can be matched, and a value routed through two helpers is not followed. Python does not follow calls into other modules.

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