State Surfaces

Agent Command-Approval Bypass: Local Checks for Shell Rewriting and Git-Hook Gaps in Coding-Agent Guardrails

Agent command-approval bypass is the gap between the command string a coding agent's guardrail inspects and what bash or git actually runs. This page gives you nine checks to run on your own machine with harmless test data, with the real output from bash 5.2.21 and git 2.43.0, so you can see the parsing gap and inventory the git state a sandbox has to cover. It also covers the GuardFall research (10 of 11 open-source agents affected) and two fixed Cursor CVEs, CVE-2026-22708 and CVE-2026-26268, and states what was tested and what was not.

Target
Tool & Environment State
Persistence
Single Turn to Cross-Session
Control
Prevent, Detect, Contain, Recover
Status
SSA Working Term
On this page 14 sections
  1. Checks you can run locally
  2. What it is
  3. What it is not
  4. In scope
  5. Target state, trust boundary, and persistence
  6. What the research establishes
  7. Detection: observable signs
  8. Defenses, containment, and recovery
  9. Boundaries with similar concepts
  10. Mapping to standards and research
  11. Related terms
  12. FAQ
  13. Sources
  14. Verification and change history

Agent command-approval bypass is SSA descriptive wording for a security-relevant gap between the command an AI coding agent's own guardrail inspects before granting unattended execution and the command the underlying shell or version-control tool actually runs. The defining mechanism is a mismatch in what two layers model as "the same action": an approval check that reads a command as a static string, and an interpreter, bash or git, that rewrites, expands, or auto-triggers on that string according to rules the check never applied. You can see both halves of the gap on your own machine in a few minutes. The checks below use a throwaway directory, echo, and a hook that prints one line. They show what bash and git do before any agent is involved, and they give you an inventory of the git state a sandbox has to cover. They do not test any agent product, and passing them does not make an agent safe.

Checks you can run locally

All output below is from one run on Linux (WSL2) with GNU bash 5.2.21 and git 2.43.0, in a scratch directory. Nothing in these checks deletes, downloads, or sends anything. Two of the checks write git configuration at global scope, so do the setup first: it points --global at a file inside the scratch directory and skips the system file, for the shell you run the checks in and nothing else.

Setup: isolate the experiment from your real git configuration

Run this in a fresh shell, or inside a subshell ( ... ), and run every later check in that same shell. The git-config manual: GIT_CONFIG_GLOBAL and GIT_CONFIG_SYSTEM "Take the configuration from the given files instead from global or system-level configuration", and GIT_CONFIG_NOSYSTEM sets "Whether to skip reading settings from the system-wide $(prefix)/etc/gitconfig file." Both are environment variables, so they stop applying when you close the shell.

$ LAB=$(mktemp -d) && cd "$LAB"
$ export GIT_CONFIG_GLOBAL="$LAB/global.gitconfig" GIT_CONFIG_NOSYSTEM=1
$ git config --global user.name lab && git config --global user.email lab@example.invalid
$ git config --global --list --show-origin
file:$LAB/global.gitconfig	user.name=lab
file:$LAB/global.gitconfig	user.email=lab@example.invalid

Every --global write below lands in $LAB/global.gitconfig. In the run shown on this page, the real global configuration was hashed before the setup and after check 9 and the two hashes were identical, and git config --global --get core.hooksPath run from a shell without these variables returned nothing (exit 1). Paths under the scratch directory are printed as $LAB.

Check 1: see the command bash runs, not the text you approved

bash -x prints each command after bash has finished quote removal and expansion, immediately before it runs. Feed it a harmless string with empty quotes inside the command name.

$ bash -xc "ec''ho placeholder"
+ echo placeholder
placeholder

The text was ec''ho placeholder. The command bash ran was echo placeholder. A guard that matches patterns against the text would be matching against a string that never executes.

Check 2: the same gap with a variable standing in for a space

$ bash -xc 'echo${IFS}placeholder'
+ echo placeholder
placeholder

There is no space in the text, so a guard that splits on spaces sees one token. Bash sees two.

Check 3: compare the approval string with the executed line

This turns check 1 into a yes/no result you can script. The xtrace line is captured, stripped of its leading + , and compared with the string that was approved.

$ s="ec''ho placeholder"
$ bash -xc "$s" 2>&1 >/dev/null | sed 's/^+ //' > trace.txt
$ cat trace.txt
echo placeholder
$ [ "$(cat trace.txt)" != "$s" ] && echo "MISMATCH: checked text differs from executed command"
MISMATCH: checked text differs from executed command

Use this as an oracle for your own guard, not as the guard. Running a command to find out what it does is only acceptable with harmless inputs like these. The useful question is whether your guard's tokenizer produces echo placeholder from both inputs above. If it does not, the guard and the shell disagree, which is the GuardFall finding restated for your code.

Check 4: inventory executable hooks in a repository

Git ignores hooks without the executable bit, and the sample hooks shipped by git init all end in .sample. So the files that can run are the executable non-sample files under .git/hooks.

$ git init -q demo && cd demo
$ find .git/hooks -type f ! -name '*.sample' -perm -u+x -print
(no output: none found)

Check 5: confirm a hook runs with no prompt from git

Write a hook that prints one line, then commit.

$ printf '#!/bin/sh\necho "placeholder pre-commit hook ran"\n' > .git/hooks/pre-commit
$ chmod u+x .git/hooks/pre-commit
$ find .git/hooks -type f ! -name '*.sample' -perm -u+x -print
.git/hooks/pre-commit
$ echo hello > a.txt && git add a.txt && git commit -q -m init
placeholder pre-commit hook ran
(commit exit=0)

Git asked nothing. This is documented behavior, not a bug: the githooks manual says the pre-commit hook "is invoked by git-commit" and "can be bypassed with the --no-verify option". The point for a sandbox is that a write to .git/hooks becomes code the next ordinary git operation runs, which is the shape of CVE-2026-26268.

Check 6: see whether core.hooksPath is set, and what pointing it at an empty directory does

$ git config --show-origin --get-all core.hooksPath
(no output, exit=1: not set in any scope)
$ mkdir -p ../empty-hooks
$ echo more >> a.txt && git add a.txt
$ git -c core.hooksPath=../empty-hooks commit -q -m second
(no hook line printed, commit exit=0)

With core.hooksPath pointed at an empty directory for that one command, the repository's pre-commit hook did not run. Now the other direction: set the empty directory at global scope (the setup makes that $LAB/global.gitconfig) and see whether a higher-precedence setting wins. A second directory local-hooks holds a pre-commit that prints "local-hooks pre-commit ran".

$ mkdir -p ../local-hooks
$ printf '#!/bin/sh\necho "local-hooks pre-commit ran"\n' > ../local-hooks/pre-commit && chmod u+x ../local-hooks/pre-commit
$ git config --global core.hooksPath "$LAB/empty-hooks"
$ git config --show-origin --get-all core.hooksPath
file:$LAB/global.gitconfig	$LAB/empty-hooks
$ echo b >> a.txt && git add a.txt && git commit -q -m global-empty
(no hook line printed, commit exit=0)
$ git config --local core.hooksPath ../local-hooks
$ echo c >> a.txt && git add a.txt && git commit -q -m local-override
local-hooks pre-commit ran
$ git config --local --unset core.hooksPath
$ echo d >> a.txt && git add a.txt && git -c core.hooksPath=../local-hooks commit -q -m cmdline-override
local-hooks pre-commit ran
$ git config --global --unset core.hooksPath

A repository-scope value and a -c argument each overrode the global value. The git-config manual states the order: files are read system, global, local, worktree, "with last value found taking precedence", and GIT_CONFIG_* environment pairs "will override values in configuration files, but will be overridden by any explicit options passed via git -c". So a global or system core.hooksPath is only meaningful if the agent cannot write .git/config or config.worktree, cannot pass -c, and cannot set GIT_CONFIG_* in the environment of the git process. That is a property of the executor that launches git, not of a config file. These runs covered pre-commit only, on git 2.43.0; other hooks, versions, and operating systems were not tested.

Check 7: hooks and repo-local config do not travel with a clone

The demo repository still has the one-line hook from check 5. Add a harmless config key as well, confirm both are present in the source, and only then clone it.

$ git config --local filter.placeholder.clean cat
$ find .git/hooks -type f ! -name '*.sample' -perm -u+x -print
.git/hooks/pre-commit
$ git config --local --get filter.placeholder.clean
cat
$ cd .. && git clone -q demo clone
$ find clone/.git/hooks -type f ! -name '*.sample' -print
(no output: none found)
$ git -C clone config --local --get filter.placeholder.clean
(no output, exit=1: not present in the clone)
$ ls clone/.git/hooks | grep -c '\.sample$'
14

The source had a runnable hook and the config key before the clone; the clone had neither, only the 14 .sample files from the local template directory. This matches the git-init manual, which says the template directory's contents are copied into $GIT_DIR when it is created. This was a local-path clone on one machine with the stock template; a template directory that someone has altered would copy whatever it holds, and other transports were not tested. The consequence for defenders: a hook planted in a repository is a local artifact of that checkout. Scanning the clone tells you nothing about the original, and a runnable hook in your working copy was written there after the clone, which in an agent setting means the agent, a build step, a changed template directory, or a tool that was allowed to write under .git.

Check 8: scan repo-local config for keys that name a command to run

Several git config keys hold a command git will execute: core.hooksPath, core.fsmonitor, core.sshCommand, core.pager, core.editor, diff.<driver>.textconv, diff.<driver>.command, filter.<name>.clean, filter.<name>.smudge, filter.<name>.process, credential.helper, merge.<driver>.driver, and any alias starting with !. A sandbox that protects .git/hooks but lets the agent write .git/config has only covered one of the paths.

$ P='^\S+\s(core\.hookspath|core\.fsmonitor|core\.sshcommand|core\.pager|core\.editor|diff\.\S+\.textconv|diff\.\S+\.command|filter\.\S+\.(clean|smudge|process)|credential\.helper|alias\.\S+=!|merge\.\S+\.driver)'
$ git -C clone config --local --list --show-origin | grep -Ei "$P"
(no output, exit=1: no matching keys)
$ git -C demo config --local --list --show-origin | grep -Ei "$P"
file:.git/config	filter.placeholder.clean=cat

The scan found nothing in the fresh clone and found the harmless cat filter that check 7 added to the demo repository. The pattern uses GNU grep's \S; on a grep without it, replace \S+ with a bracket expression for non-space characters.

One scope flag changes what the scan sees. The git-config manual says --includes "Defaults to off when a specific file is given (e.g., using --file, --global, etc) and on when searching all config files." So a --local read skips include.path targets unless you ask. Tested by putting a second harmless filter in a separate file and including it:

$ cd demo
$ git config --file ../extra.gitconfig filter.included.clean cat
$ git config --local include.path "$PWD/../extra.gitconfig"
$ git config --local --list --show-origin | grep -Ei "$P"
file:.git/config	filter.placeholder.clean=cat
$ git config --local --includes --list --show-origin | grep -Ei "$P"
file:.git/config	filter.placeholder.clean=cat
file:$LAB/demo/../extra.gitconfig	filter.included.clean=cat
$ git config --list --show-origin | grep -Ei "$P"
file:.git/config	filter.placeholder.clean=cat
file:$LAB/demo/../extra.gitconfig	filter.included.clean=cat

The all-scope form is the one to run, because it follows includes by default and shows every scope with its origin file (in this run the global file held only user.name and user.email, since check 6 unset core.hooksPath again, so no global line matched). This scan is a starting inventory of keys that name a command, not a complete list of dangerous settings: it does not cover GIT_CONFIG_* or other environment variables, -c arguments, config.worktree, or keys this pattern does not name. Run the same scan with --global and --system to cover the scopes a repository write cannot reach but a home-directory write can.

Check 9: scan a directory tree for hooks and nested repositories

$ cd ..
$ find . -path '*/.git/hooks/*' -type f ! -name '*.sample' -perm -u+x -print
./demo/.git/hooks/pre-commit
$ find . -name .git -prune -print
./demo/.git
./clone/.git

This is a simple first pass, not a complete inventory. The first command lists executable non-sample files under a conventional .git/hooks directory. It misses hooks in a directory named by core.hooksPath, hooks reached through a symbolic link, and the hooks directory of a worktree or submodule, whose checkout has a .git file containing gitdir: rather than a .git directory. The second command lists entries named .git, so it finds nested checkouts; it does not find a bare repository, which per the gitrepository-layout manual is itself the repository directory and has no .git entry inside it. To extend it, also search for .git files and for any directory named hooks that holds executable files.

What was tested and what was not

Tested: bash 5.2.21 and git 2.43.0 on Linux under WSL2, with GIT_CONFIG_GLOBAL and GIT_CONFIG_NOSYSTEM set as in the setup block and the real global configuration confirmed unchanged by hash; the pre-commit hook; core.hooksPath set by -c, at global scope, and overridden by local scope and by -c; clone behavior for a hook and a local config key added before the clone, local path transport, stock template; the config scan with and without --includes against one harmless filter key and one included file.

Not tested: any coding agent, IDE, or its guard, allowlist, or sandbox; whether any product honors or resets core.hooksPath; hooks other than pre-commit; --no-verify; config.worktree and GIT_CONFIG_* environment overrides; Windows, macOS, or other shells; network clone transports; whether the GuardFall findings still reproduce against current releases of the agents named below. Nothing above is evidence that a given product is or is not affected today. The checks detect state and show the parsing gap; they do not block anything.

What it is

The defining object is the approval-decision state an agentic coding tool consults before running a shell command or a version-control operation without asking a human first: an allowlist of pre-approved commands, a denylist of blocked patterns, or a sandbox boundary that is supposed to contain whatever the agent runs. The defining cause is that this decision is made against a representation of the action, usually the literal command string the model drafted, that does not match what actually executes once a real interpreter gets hold of it. The defining consequence is that an attacker, or an agent manipulated by prompt injection, does not need to defeat the guardrail's logic at all; the guardrail approves exactly what it was designed to approve, and something else entirely runs underneath it.

Two mechanisms produce this gap. The first is textual: bash performs quote removal, variable and command substitution, and word splitting on a command string after a guard has already inspected the pre-transformation text, so a string that reads as safe to the checker can execute as something else once the shell is done rewriting it. Checks 1 to 3 show this with echo. The second is structural: a tool like git has its own trusted, automatic execution paths, hooks fired on routine operations such as checkout or commit, that a sandbox's write protection may not cover, so a write the sandbox was supposed to contain becomes code the sandbox never gets a chance to stop. Checks 4 to 9 inventory that state.

What it is not

  • Sandbox configuration escape, where an already-compromised session writes to host-side configuration, a session hook, or a CI cache entry that a later launch or pipeline run reloads with elevated trust. That entry path requires a later reload across a session or workflow boundary. This entry's defining failure happens inside one approval decision, for one action, with no later reload required: the guardrail is simply wrong about what the single command it is approving will do.
  • MCP tool poisoning, where the attack targets what a tool's description or result claims. This entry targets what a command-approval mechanism believes a shell string or git operation will do, independent of any tool description.
  • A denylist that is merely incomplete because a vendor has not yet added a known-bad pattern. The sources below describe a structural mismatch between string inspection and shell execution semantics, present even in a denylist tuned against every pattern its authors could think of.
  • Reproducible bypass payloads tuned to a specific agent's current guard implementation.

In scope

  • Guardrails, allowlists, and denylists that inspect a command as a static string before an interpreter transforms it.
  • Shell-level rewriting, quote removal, variable expansion ($IFS), command substitution, and output piped into an interpreter, that changes what a pre-approved-looking string executes.
  • Sandbox or isolation boundaries that fail to extend their write protection to a tool's own automatic, trusted execution paths, such as git hooks and the git config keys that name a command.
  • Auto-run or auto-approve modes that let an agent execute commands without per-action human confirmation. They increase how often an unattended approval decision is made; they are not a precondition for the class, since a hook in .git/hooks fires on a git operation a human approved just the same.
  • Defensive controls for guard architecture, sandbox scope, and least-privilege execution.

Target state, trust boundary, and persistence

The target state is the approval decision itself: the boolean or policy outcome an agent's host application computes to decide whether a command runs unattended. The trust boundary that fails is the assumption that inspecting a command's text is equivalent to knowing what will execute, when in practice a real shell or a real git invocation sits between that inspection and the actual effect, and neither research source below treats that gap as a vendor-specific implementation slip; both treat it as a property of checking a string instead of the interpreter's own behavior.

Persistence varies by mechanism. A shell-rewriting bypass, the GuardFall class below, is single-turn: the mismatch exists for exactly the one command executed and leaves no standing artifact once that command finishes, though an attacker can trigger it again on the next unattended command the agent runs. A git-hook bypass is different: once a hook is written into a repository's .git directory, it persists in that checkout and can fire again on a future commit, checkout, or merge in a later session, which makes the git-specific variant cross-session by construction rather than confined to the single action that planted it. Check 7 narrows where to look: the hook is in the checkout that was written to, not in clones made from it.

What the research establishes

Adversa AI published GuardFall on 2026-06-30, authored by researcher Omer Ben Simon, after finding that a 30-pattern regex denylist in NousResearch's Hermes agent could be defeated through shell rewriting, a finding that produced a fix commit in that project. The research tested eleven popular open-source coding and computer-use agents and found ten exploitable through the same root cause: "a guard inspects raw text, while system shell (bash) expands, unquotes, and rewrites text before running it." Its worked example is a destructive command name with empty quotes inserted: the raw string and the command name bash runs after quote removal differ, which is the same mechanism check 1 shows with ec''ho. The report documents further classes, including a variable standing in for a space (check 2 shows the harmless form), command substitution, encoded output piped into an interpreter, and destructive operations that never contain the blocked command name; the specific strings are in the original report and are not repeated here. The affected agents split into tiers by guard design: Hermes, opencode, and Goose check a denylist against the raw string; Cline's opt-in mode and Roo-Code tokenize but still miss the bypass classes; Aider, Plandex, Open Interpreter's default mode, and Cline's default mode run with no static guard at all; and OpenHands and SWE-agent are sandboxed by default but not in their documented local mode. Only Continue, among the eleven, closed the bypass class the research tested, by tokenizing commands the way bash itself does, escalating variable expansion to a permission prompt, recursively checking command substitutions, and inspecting pipe destinations, though the research also found that Continue's CLI --auto flag discards its own soft-block tier. Coverage of the research puts the combined GitHub star count of the ten affected projects at roughly 548,000, and quotes the report's own framing directly: "GuardFall is not a bug, but a dangerous convention and a class of problems" (Adversa AI, GuardFall: a universal shell injection vulnerability in open-source AI agents; Security Affairs, GuardFall Flaw Hits 10 of 11 Popular Open-Source AI Agents (2026-07-01)).

Two separate, fixed vulnerabilities in Cursor, a commercial AI code editor, show the same class of gap reached through different approval mechanisms entirely. CVE-2026-22708 affects Cursor versions before 2.3: when the Cursor Agent runs in Auto-Run Mode with Allowlist mode enabled, certain shell built-ins execute without matching the allowlist and without requiring approval, which lets direct or indirect prompt injection poison the shell environment by setting, modifying, or removing environment variables that influence how later, genuinely allowlisted commands behave. The CVE record lists CWE-15 as the primary weakness with CWE-78 among the others, carries a CVSS 4.0 base score of 7.2 from the CNA, was published 2026-01-14, and was fixed in Cursor 2.3 (CVE Record, CVE-2026-22708; Lutra Security Fieldguide, CVE-2026-22708). CVE-2026-26268 affects Cursor versions before 2.5: the sandbox did not sufficiently restrict writes to .git configuration and hook files, so an agent manipulated by prompt injection, or acting on a malicious repository, could write a hook that fires the next time Cursor's agent runs an ordinary git operation, executing outside the sandbox with no further user interaction. Researcher Assaf Levkovich of Novee, who reported the issue, noted that "the underlying Git behavior allowing the attack path is well documented," which checks 5 and 8 above confirm from git's own manuals. The classification is CWE-862, Missing Authorization; the record was published 2026-02-13; the fix shipped in Cursor 2.5; and the severity rating itself became a documented point of disagreement, with the CNA's own score of 8.1 against NVD's analysis of 9.9 Critical (CVE Record, CVE-2026-26268; CSO Online, Critical Cursor bug could turn routine Git into RCE).

These three sources establish the same underlying claim from three angles: GuardFall shows the gap in open-source agents' own command guards, CVE-2026-22708 shows it in a commercial product's allowlist enforcement, and CVE-2026-26268 shows it in a sandbox's write-protection scope rather than in a command guard at all. None of the three required defeating the model; each defeated the layer sitting between the model's decision and the system's actual execution.

Detection: observable signs

  • An executed shell command's post-expansion form, what the interpreter actually ran, differs from the literal string an agent's approval log recorded as having been checked. Check 3 is the one-line version of this comparison.
  • Environment variables an agent did not explicitly set through an approved action change value between one tool call and the next, especially variables that influence how a later, allowlisted command resolves or behaves.
  • An executable non-sample file appears under .git/hooks, or a command-bearing key appears in .git/config, in a checkout where no human or build step put it there. Checks 4, 8, and 9 list both.
  • An agent's command-approval log shows a pattern that matches a known-safe allowlist entry character-for-character while producing an effect, a file deletion, a credential read, a network call, inconsistent with that entry's documented purpose.
  • Auto-run, auto-approve, or --auto-style flags are enabled against a repository or session that processes untrusted content, such as a cloned repository, a fork pull request, or ingested issue text.

Defenses, containment, and recovery

The table below is SSA editorial guidance for defenders. It is neither a standard requirement nor a measured effectiveness ranking. Where a row says "tested here", it refers to the checks above and nothing more.

Control

Transition it interrupts

Applicability

Residual risk and verification

Prefer or require guard architectures that tokenize and canonicalize a command the way the target shell actually parses it, rather than matching patterns against the raw string

A guard approving text that the shell will rewrite into something else before running it

Any deployment selecting or configuring a coding agent's command-approval layer

Per the GuardFall research, this closed the tested bypass class in the one agent (Continue) that implemented it, but that agent's own --auto flag still discarded a softer protection tier; verify every execution mode, not only the default one. Checks 1 to 3 give you harmless inputs to test a tokenizer with; they do not prove a tokenizer complete.

Disable auto-run, auto-approve, or --auto-style flags whenever the agent will process untrusted content, including cloned repositories, fork pull requests, and ingested issues or documents

Untrusted content reaching an unattended command-approval decision

Any agent deployment that offers an unattended execution mode

Reduces unattended execution; it does not remove the class. A human who approves an ordinary git commit or checkout still triggers whatever hook sits in .git/hooks (check 5), and a human reading an approval prompt sees the same pre-expansion text the guard saw (check 1). Costs the automation the mode was added for. Not tested here.

Scope sandbox write protection explicitly to every path a wrapped tool treats as trusted executable configuration, including .git/hooks and the command-bearing keys in .git/config, not only the files the sandbox's own settings live in

A sandboxed write landing in a tool's own automatic execution path instead of the sandbox's protected configuration files

Any coding agent wrapping git, a build tool, or another subprocess with its own hook or plugin-execution mechanism

CVE-2026-26268 shows this gap persisting even in a product that already sandboxes most writes; re-audit after every new tool integration. Checks 4, 8, and 9 enumerate the git paths; no product's sandbox was tested here.

Run git through a trusted executor that fixes core.hooksPath to a directory the agent cannot write, and that the agent cannot override

A hook written into a checkout's .git/hooks being the one git runs

Deployments where the agent's git invocations go through a wrapper or sandbox the agent does not control

Tested here only for pre-commit, on git 2.43.0: a per-command -c to an empty directory and a global-scope setting each silenced the repository hook, and a local-scope value or a -c argument each overrode the global one (check 6). Protecting the global or system file is therefore not enough: the executor also has to deny writes to .git/config and config.worktree, strip -c core.hooksPath arguments, and clear GIT_CONFIG_* from the environment, or set the value itself with -c as the last word. Whether any agent product does this was not tested.

Block agent-driven execution against fork pull requests and untrusted repositories at the CI or pipeline level, independent of the agent's own guard

Reliance on an agent's own in-process guard as the only control against untrusted repository content

CI and build pipelines that let an agent act on externally contributed code

A pipeline-level block does not help a local, interactive session where the same untrusted repository is opened directly; pair with sandboxed local execution. Not tested here.

Apply least privilege by task type, so code-review, testing, and build tasks each receive only the permissions and environment access that task needs, rather than one standing privilege level for every agent action

Blast radius once any single bypass in this class succeeds

Any deployment that currently grants an agent uniform privilege across unrelated task types

Limits consequence, not occurrence; a scoped-down agent can still be tricked into the action its narrower scope does permit. Not tested here.

Prevention should treat a command-approval guard that only pattern-matches raw text as insufficient by design, and should scope sandbox write protection to every trusted-execution path a wrapped tool exposes, git hooks and command-bearing config keys included, not only to the agent's own settings files. Detection should compare the post-expansion command an interpreter actually ran against the pre-expansion string an approval log recorded, since the two research sources above show the gap living exactly in that difference. Containment should disable auto-run modes and revoke credentials reachable from the session the moment a bypass is suspected, treating the agent's standing privilege as already compromised rather than confined to the one command that triggered the finding. Recovery should run checks 4, 8, and 9 across every checkout the agent touched, since a git-based bypass, unlike a single-turn shell bypass, leaves a standing artifact that can fire again in a future session.

Boundaries with similar concepts

This differs from sandbox configuration escape in where the failure happens and what has to happen next. That entry's defining pattern is a write that outlives the sandbox and is reloaded with elevated trust at a later launch or pipeline run, the gap sitting between sessions. This entry's defining pattern is an approval decision that is simply wrong about the single action it is approving, the gap sitting inside one decision; no later reload is required for the GuardFall shell-rewriting class, though the git-hook variant does leave a persistent artifact behind in the way sandbox configuration escape does.

This also differs from MCP tool poisoning in the object under attack. That entry targets the metadata a tool presents about itself, its description or its returned result, and the trust an agent places in that metadata. This entry targets the fidelity of an approval mechanism's model of a command's own execution semantics, independent of any tool description or MCP server involvement at all.

Mapping to standards and research

Source

Source-owned term or item

Relationship to this article

Adversa AI (2026-06-30)

GuardFall

Primary-source research demonstrating the raw-string-versus-shell-semantics bypass class across ten of eleven tested open-source agents.

Cloud Security Alliance, Research Note (2026-07-01)

MAESTRO Layer 3 (Agent Frameworks) and Layer 4 (Deployment); AI Controls Matrix, Execution Control domain

Independent framework mapping of the GuardFall finding, with vendor-neutral mitigation guidance this article's defenses table draws on.

CVE Program / NVD

CVE-2026-22708; CWE-15, CWE-78

Primary-source evidence of a fixed allowlist-bypass defect in Cursor's Auto-Run Mode.

CVE Program / NVD

CVE-2026-26268; CWE-862

Primary-source evidence of a fixed sandbox write-protection gap in Cursor reaching git's own hook-execution path.

Git project, githooks and git-init manuals

core.hooksPath; hook executable bit; --no-verify; template directory

Documented git behavior behind checks 4 to 9: which files can run, when they run, and what a clone copies.

OWASP GenAI Security Project

Top 10 for Agentic Applications 2026, ASI05:2026 Unexpected Code Execution (RCE)

SSA-selected OWASP category for untrusted content or state becoming executed code through an agent's own tool-invocation path.

MITRE ATLAS

AML.T0053 AI Agent Tool Invocation; AML.T0050 Command and Scripting Interpreter

SSA-selected ATLAS techniques for the tool-invocation step a bypassed guardrail fails to constrain, and the interpreter-level execution it reaches.

Agent State Attack

Agent command-approval bypass

SSA descriptive framing bundling the GuardFall research and the two Cursor CVEs under one Tool & Environment State entry, plus the local checks above.

  • Agent state attack: the umbrella definition, including Tool & Environment State among the listed target states.
  • Sandbox configuration escape: the adjacent Tool & Environment State entry for writes that outlive a sandbox and are reloaded with elevated trust at a later launch, contrasted above by persistence and trigger condition.
  • MCP tool poisoning: a related Tool & Environment State pattern concerning what a tool's description or result claims, rather than what a command-approval mechanism believes a shell string or git operation will do.
  • Agent checkpoint poisoning: another Tool & Environment State entry where the failure sits in a framework's own persistence layer rather than in a command-approval decision.

FAQ

Does adding more patterns to a denylist fix this?

Not durably, according to the GuardFall research. Its core finding is that a guard checking raw text cannot keep up with a shell's own rewriting rules, quote removal, expansion, substitution, because each new denylist pattern only blocks the specific strings its author thought of, while the underlying interpreter's transformation behavior stays unchanged and available for the next unconsidered string. Checks 1 and 2 show two of those rules on a harmless command.

Is this the same as classic shell metacharacter injection?

It shares the underlying interpreter behavior, but the entry path differs. Classic command injection targets an application passing unsanitized external input to a shell. This pattern targets an AI agent's own command-approval layer, a guard specifically built to let the agent run shell or git operations unattended, so the bypass defeats a security control that was added because of agentic autonomy, not a missing one.

If check 6 silences the hook, is core.hooksPath a fix?

Not on its own. It was tested here for one hook on one git version, and check 6 also shows the limit: a global core.hooksPath was overridden by a repository-scope value and by a -c argument, and the git-config manual adds config.worktree and GIT_CONFIG_* environment pairs above the global file. A setting the agent can override in any of those places is not a control. It only holds when the process that launches git, not the agent, decides the final value and the directory it points to is outside the agent's write scope. Confirm your agent product does not reset it; that was not tested here.

Sources

Checked November 4, 2026.

Verification and change history

Standards and versions referenced: OWASP Top 10 for Agentic Applications, Version 2026 (December 2025); MITRE ATLAS, data release v2026.06 (2026-06-30); CWE-15; CWE-78; CWE-862; GNU bash 5.2.21; git 2.43.0.

Last verified: 2026-11-04, against the sources listed above. The CVE details come from the CVE Program's record data (CNA: GitHub); the NVD 9.9 figure for CVE-2026-26268 is as reported by CSO Online and was not re-read from NVD on this date.

Change history: 2026-10-09, first version. 2026-11-04, added nine local checks with their real output, a tested-and-not-tested statement, a core.hooksPath row in the defenses table limited to what was tested, git manual sources, and the CVE-2026-22708 primary CWE; re-verified all sources. Same day, after an independent fact check: reran the clone test with the hook and config key added before cloning, added the core.hooksPath precedence run and the --includes run, limited the scope claims of checks 8 and 9, corrected the auto-run and core.hooksPath rows so neither reads as removing the class, and replaced the quoted obfuscation strings with a description plus a reference to the original report. After a second fact check: added the setup block that isolates --global writes with GIT_CONFIG_GLOBAL and GIT_CONFIG_NOSYSTEM, reran every command on the page inside that isolation and replaced the outputs with that run, and corrected the in-scope bullet that still called auto-run a precondition for the class.

Working-term label: Mixed provenance. "GuardFall" is an Adversa AI research term. CVE-2026-22708, CVE-2026-26268, CWE-15, CWE-78, and CWE-862 are Standard Terms owned by the CVE Program and MITRE respectively. "MAESTRO" and its layer identifiers are Cloud Security Alliance terms. ASI05:2026 is an OWASP Standard Term. AML.T0053 and AML.T0050 are MITRE ATLAS Standard Terms. "Agent command-approval bypass" as the umbrella title for this entry, and the nine checks, are SSA descriptive wording and editorial work, not attributed to any single source above.

This reference is defensive in scope. It classifies state changes and controls without publishing exploit recipes.

Back to the reference