AAK-IDE-TASK-002: VS Code task command reaches a shell via pipe, repo-path interpreter, or interpolation
- Severity
- HIGH
- Category
- Hook Injection (
hook-injection) - Scanner
agent_audit_kit/scanners/ide_task_rce.py- Auto-fixable
- No.
- SARIF name
IdeTaskShellInjection
What it detects
A task in .vscode/tasks.json builds its command/args in a way that reaches a shell: a pipe-to-shell (... | sh), an interpreter invoked on a script path inside the repo, or a ${...}/interpolated variable spliced into a shell string. A poisoned repository controls that string, so opening or running the task executes attacker-chosen code.
How to fix
Do not pipe downloaded content into a shell and do not interpolate variables into shell command strings. Invoke a vetted, in-tree binary with a fixed argv, and pin or verify any script the task runs.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-IDE-TASK-002
Limitations
Judges a task by its own command and args text: a pipe into sh, bash, zsh, dash, ksh, fish, pwsh or powershell; python, python2, python3, node, deno, bun, ruby, perl, php, bash, sh or zsh followed directly by a path of letters, digits, _, -, ., / and \ that ends .py, .js, .cjs, .mjs, .ts, .rb, .pl, .php, .sh, .bash, .zsh or .ps1, where the path may start with the workspace folder as ${workspaceFolder}, ${workspaceFolder:name}, ${workspaceRoot} or ${fileWorkspaceFolder}; or ${, %{, {{, $(, a backtick or a string + directly before a name beginning input, args, event, payload, user, argv or request. A script run directly (./scripts/setup.sh), through a runner (npm run setup) or after a flag (bash -x ./scripts/setup.sh), and a quoted path (bash "${workspaceFolder}/scripts/setup.sh"), are not followed. A tasks.json or launch.json over 1 MB is not read.
References
- OWASP Agentic Top 10: ASI05 (Unexpected Code Execution (RCE))
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-RCE-05
- CSA AI Controls Matrix (AICM): STA-08, 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-IDE-TASK-002.md: the page then shows that text, with the registry reference appended under it.