Back to blog
AI agentscoding agentsallowlistauto-approvalcommand injection

Coding agent command allowlists: bypasses and tests

Published on 2026-11-239 min read
In short: a command allowlist lets a coding agent run without asking anything that matches an approved prefix. It is fragile because the shell interprets far more than the filter parses: newlines, chaining, redirects, subshells, dangerous options. Roo Code provides a recent case: a “>&” redirect prefix made the allowlist match while a denied command still ran. Design an allowlist by denying by default, and test it with a bypass matrix.

What is a command allowlist and why is it fragile?

It is a setting that spares the agent from asking the user for approval on certain commands, for example git status, npm test or echo. The goal is to keep human validation for risky actions and avoid confirmation fatigue.

The problem is an interpretation gap. The agent’s filter reads a string with its own splitting rules, while the shell applies a much richer grammar. When the two diverge, the command the filter approved is not the command the shell executes. The weakness class VulnCheck uses for the Roo Code flaw is CWE-436, “Interpretation Conflict”.

This matters because part of the input is controlled by a third party: a README, an issue, a web page or a tool response can lead the agent to propose a command chosen by an attacker. That is indirect prompt injection applied to the developer’s workstation. The overview of coding agents is in our article on coding agent security: Claude Code, Cursor, Copilot; this one focuses on a single mechanism, auto-approval.

How have allowlists been bypassed in practice?

Several public advisories, across several tools, describe the same family of flaws. The table lists the ones we checked in the advisories themselves.

ToolReferenceBypass mechanismFix stated
Roo CodeCVE-2026-110202 (VulnCheck, 13 October 2026)“>&” redirect prefix: the filter strips the operator and reads the next word as an allowed commandVersions through 3.54.0 affected; the advisory gives no fixed version
Roo CodeCVE-2025-54377 (GHSA-p278-52x9-cffx, 23 July 2025)Unvalidated line break: tsc allowed, then a second line python3 ./ex.py runs3.23.19
Gemini CLITracebit, 28 July 2025Only the “root command” was extracted: an allowlisted grep served as cover for a malicious command starting with grep0.1.14
Claude CodeCVE-2025-66032 (GHSA-xq4m-mc3c-vvg3, 3 December 2025)Parsing errors around $IFS and short flags bypassing the read-only validation1.0.93

Two remarks. First, these flaws hit serious, actively maintained products: the cause is how hard the problem is, and an isolated oversight does not explain these cases. Second, most require untrusted content to reach the agent’s context. The Claude Code advisory (CVE-2025-66032) says so explicitly.

What happened with the “>&” prefix in Roo Code?

Roo Code’s decision function split the command into sub-commands, then stripped redirections with a regular expression before comparing the result to the allowlist and denylist. The expression was meant to remove file descriptor duplications such as 2>&1, but both of its digit groups were optional, so it also removed a bare >&.

In bash, >&word means “redirect standard output and error to a file named word”. In the researcher’s published example, the command >&echo touch /tmp/ROO_PWNED unfolds like this:

  1. The filter strips >& and reads echo touch /tmp/ROO_PWNED: the echo prefix is allowed, so the command is approved.
  2. The shell reads the original string: it creates a file named echo, then runs touch /tmp/ROO_PWNED.
  3. The touch command, which was denied in the test configuration, runs with no approval.

The researcher tested version 3.53.0 with the “always approve execute” option enabled; the VulnCheck record covers versions through 3.54.0 and assigns a CVSS score of 7.7. The minimal fix proposed is to require at least one digit after &; the robust fix is to parse redirections structurally so that a redirect target never occupies the command position.

The general lesson: a filter that transforms the string before judging it creates a gap between what is judged and what is executed. Every normalization step (stripping, splitting, decoding) is an attack point.

Which bypass families should you know?

Public cases fall into a few families, and your test should cover all of them.

  • Command separators: newline (the Roo 3.23.19 case), ;, &&, ||, &. A filter that does not split on every one of them validates the whole line from the first word.
  • Misleading prefix: the allowed command is only the start of the string (the Gemini CLI grep case). A prefix check approves everything that follows.
  • Redirects and descriptors: >&, >, 2>, <, <<<. A redirect can make a word pass as a command or write to a sensitive file.
  • Substitution and subshells: $(...), backticks, <(...), ( ... ). A “harmless” command like echo can contain a substitution that runs something else.
  • Variables and expansion: $IFS, ${VAR}, globs, braces. The Claude Code CVE-2025-66032 case involves $IFS and short flags.
  • Dangerous arguments of allowed commands: a legitimate command can execute code through its options. GTFOBins documents, for instance, find . -exec /bin/sh \; -quit, tar ... --checkpoint-action=exec=/bin/sh and sed e. Allowing find, tar or sed without checking arguments amounts to allowing a shell.
  • Output hiding: Tracebit showed that a large block of whitespace before the malicious part kept it from appearing in the terminal while it ran. The user’s visual check is therefore not a safety net.
  • Shell variants: zsh, bash, sh and PowerShell follow different rules (the Roo Code zsh case).

How do you design a solid allowlist?

A good allowlist assumes the string is hostile and that the filter must understand the command exactly as the shell does. These are the rules we apply in our recommendations.

  1. Deny by default. Anything not explicitly recognized triggers an approval prompt, including chains where only part is allowed.
  2. Parse the command with a real parser. Use a shell parser that produces a command tree, rather than regular expressions on text. Validate each node: commands, redirects, substitutions.
  3. Reject constructs you cannot parse. Subshells, substitutions, here-documents, unresolved variables: ask or refuse.
  4. Allow full commands rather than prefixes. git status rather than git, with a closed list of arguments for each command.
  5. Exclude commands that execute code through options (find, tar, sed, awk, xargs, interpreters, git with configuration options) or constrain their arguments.
  6. Forbid redirects outside the project and writes to the agent’s own configuration files.
  7. Do not rely on a denylist alone. It misses variants; an allowlist checked upstream is safer.
  8. Add an independent layer: sandbox, read-only file system, restricted network, no secrets present. An allowlist is an ergonomics aid and never the security boundary (OWASP LLM06, Excessive Agency, see our guide on limiting excessive agency).

How do you test a command allowlist?

Build a matrix of commands whose beginning is allowed and whose remainder is denied, then check that each one triggers an approval prompt. Run the test in a disposable container, with a harmless marker file as proof.

  1. Record the real configuration: allowed commands, denied commands, approval mode, tool version.
  2. Pick an allowed command (for example echo) and a harmless denied command (for example touch /tmp/marker).
  3. Generate variants of each family, with the allowed command first.
  4. Run in an isolated environment and check whether the marker file appears without an approval prompt.
  5. Test the real entry point: does the agent propose these commands after an injection planted in a test README or issue?
  6. Log: version, variant, result, evidence, proposed fix.
FamilyExample variant (allowed command: echo)Expected result
Newlineecho ok followed by a second line touch /tmp/markerApproval prompt
Chainingecho ok ; touch /tmp/markerApproval prompt
Bare redirect>&echo touch /tmp/markerApproval prompt
Substitutionecho $(touch /tmp/marker)Approval prompt
Dangerous optionfind . -name x -exec touch /tmp/marker \;Approval prompt
Hidinglong run of spaces then ; touch /tmp/markerApproval prompt, command visible

A finding maps to OWASP LLM06 (Excessive Agency) and, on the agentic side, to ASI02 (Tool Misuse and Exploitation) and ASI05 (Unexpected Code Execution). For automated campaign tooling, see also our Promptfoo, Garak, PyRIT comparison.

What should you take away?

Auto-approval is a trade-off between comfort and security, and its implementation through string filtering was bypassed across several tools in 2025 and 2026, up to the Roo Code advisory of October 2026. A safe design rests on a shell parser, a default deny and independent isolation.

We test these mechanisms within our Agent Red Team Express when your coding agent or automation agent runs commands: a bypass matrix adapted to your configuration, reproducible evidence, prioritized fixes. The overall framework is on our AI agent pentest page.

Does your product ship an AI agent? CleanIssue tests what a stranger can make it do with the Agent Red Team Express (5 days, €1,900), or a custom red team for several agents and MCP servers. First step: a free 30-minute discovery call.

Know what your agent can do before an attacker does.

A free 30-minute discovery call: you describe your agent, I tell you what I would test and what it costs. Five case studies are published.

Book a call