Skip to content
AI Security Wire

Published

- 5 min read

By

ParseGap: Eight Coding Agents Approve Shell Commands Bash Reads Differently

img of ParseGap: Eight Coding Agents Approve Shell Commands Bash Reads Differently

A preprint posted to arXiv on November 22 reports that all eight production coding agents it tested can approve a shell command that Bash then runs differently from what the policy intended. Jieyu Li’s paper, “ParseGap: Testing What Coding Agents Authorize and What Shells Execute”, identifies 17 root causes across the eight products. Live trials with two frontier models triggered policy violations in all 16 agent and model pairs. Everything below is the paper’s own account, and we have not reproduced any of it.

The core problem: two readings of one string

Each agent decides whether to run a command by parsing the string against a policy, then passes the same raw string to a system shell. The checker uses its own parser (shell-quote tokenizers, tree-sitter-bash syntax trees or Starlark prefix rules). Bash parses the string again, and each utility reads its own arguments. The paper’s point is that the gate only judges its own reading.

Its running example is small. A read-only policy allows uniq, and the agent proposes uniq README.md /var/tmp/x. Six of the eight agents allow it. uniq treats its second operand as an output file, so it writes outside the workspace. Each component followed its own specification. The failure sits between the layers.

Three divergence boundaries

The authors group the 17 root causes by where authorization and execution split.

The parse. The authors report an upstream tree-sitter-bash defect, found in the Python build used by Mistral Vibe 3.1.4 and the WASM build in Gemini CLI 0.70.0. A two-line input puts an escaped command word right after an unescaped newline. Bash treats the newline as a separator and runs line two. The tree-sitter scanner folds line two into an argument of the first, allowlisted command, so the syntax tree the policy sees has no second command. Deny rules never observe it. The exact byte sequence is redacted. Separately, Qwen Code 0.28.3 detects nested command substitution and asks, but a matching user allow rule on the outer command silently upgrades that “ask” to “allow”. The paper attributes Qwen Code’s 63.6% CVE-Replay and 43.3% Attack-1K bypass rates under its allowlist (P1) profile to this.

The utility. No parsing error is needed here. Every checker admitted attack cases built only from allowlisted inspection tools. The paper reports allow rates of 9 of 55 cases for Continue, 20 of 55 for Mistral Vibe and 39 to 47 of 55 for the other six. The mechanisms are output-file arguments (uniq IN OUT, sort -o, git diff --output=), embedded execution flags (sed execute directives, rg --pre, sort --compress-program) and inline environment variables such as GIT_TRACE. Roo, OpenCode, Gemini and Qwen also leave output redirections unguarded.

The confinement. In Codex CLI 0.171.0, the paper says matching an allow rule disables the OS sandbox (implementation details are redacted). The paper’s strace runs showed zero bwrap processes for the allowlisted cases, even with --sandbox read-only. With the sandbox applied alone, the same suites produced no persistent file changes (0 of 55 and 0 of 28). With allow rules added, the sandbox was skipped on 39 of 55 utility cases. Configuring read-only allow rules removed the confinement the user thought they had.

Live trials

Under configured restrictions, prohibited effects occurred in 32 of 33 trials with gpt-5.6-luna and 24 of 33 with deepseek-v4.1-flash. Across 66 configured-rule trials, a vendor gate blocked a verbatim witness once (Qwen Code’s edit check on sort -o). Of the deepseek non-hits, nine were model refusals. In separate prompt-injection trials delivered through a README, OpenCode produced the targeted effect in 4 of 4 runs with one model and 2 of 4 with the other.

The proposed fix

The authors propose ShellPlan. It compiles a strict Bash subset into a typed execution plan once, checks each utility’s arguments against positive capability specifications and runs the plan through execve without a shell. They report 0 of 4,174 active attacks admitted, 0 of 90 hits in a ten-model benchmark (62 of 90 unguarded) and 1.28 ms median gate latency. These figures come from the authors’ own suites and are not independently reproduced.

What defenders can do

  • Treat allowlists of “read-only” binaries as unsafe by default. sort, uniq, sed, rg and git diff all have write or execute options.
  • Do not rely on a permission prompt alone. Run agents in a container or VM with filesystem and network limits that do not depend on the agent’s own approval decision.
  • Check what your allow rules do to the sandbox. For Codex CLI, the paper says matching allow rules disabled the read-only sandbox in the tested version. Verify on your own setup.
  • Keep untrusted repository content away from agents holding broad allow rules. Prompt injection through a README is the path the paper’s trials used.
  • Watch for vendor advisories. Counting 90 days from Nov 22 gives about February 20, 2027 (our arithmetic), and the paper says unredacted details return in v2 once patches exist.

Caveats

This is a single-author arXiv v1 preprint, and we found no peer-review status. Product versions were fixed at testing time, and vendors may already differ. We found no vendor responses as of Nov 24. The 17 root causes include permissive default modes and a classifier gap, not only bypasses of a configured gate, so the headline count mixes severities.

References

Frequently Asked Questions

What is the ParseGap problem?
Coding agents check a shell command string against a permission policy, then hand the same raw string to Bash. The checker and the shell each parse it, and each utility interprets its own arguments, so a command can pass the gate and still do something the policy forbids. The paper calls the three failure points the parse, the utility and the confinement boundary.
Which agents does the paper say are affected?
The authors tested eight production agents: Cline, Continue, Roo Code, OpenCode, Gemini CLI, Qwen Code, Mistral Vibe and OpenAI Codex CLI. Specific findings name Mistral Vibe and Gemini CLI for a parser defect, Qwen Code for a rule-precedence flaw and Codex CLI for an allow rule that disables its read-only sandbox. The versions tested are listed in the paper.
Is there a patch?
Not that we have confirmed. The paper says defects were privately reported on November 22, 2026 under a 90-day window to OpenAI, Google OSS VRP, Mistral, the tree-sitter-bash maintainers, Qwen Code, OpenCode and Cline Security, with only courtesy archival notices to Roo Code and Continue (both archived). Exact trigger sequences are redacted until fixes ship. Our editorial review found no evidence of advisories as of Nov 24, 2026 in GitHub security-advisory lists for the eight agent projects and tree-sitter-bash, but we did not check vendor blogs or changelogs.