Matching Text Is Not Mediating Action: A Mutation Study of a Pattern-Based Command Guardrail in a Tool-Using LLM Agent

Tool-using LLM agents often rely on a deterministic guardrail that inspects each proposed tool call before it runs. A typical design matches shell commands against a block list and a confirm list of regular expressions, and combines the verdict with a user-selected permission mode. Such a guardrail is easy to audit, but it matches text, while the shell executes after quote removal, escape processing and parameter expansion. We measure the size of this gap on the production guardrail of a multi-agent platform. We use no LLM and execute no command. We mine all 26 flagged command literals from the project's own test suite, which cover 17 of its 34 patterns. Each literal is passed through 13 rewrites plus the identity, and we record the guardrail's verdict and the permission gate's decision under four modes. Separately, we check each rewrite on a benign command in bash and sh, and only rewrites that keep the command's behaviour count as evasions. Rewrites at the whitespace, wrapper and command-chaining level never evaded the guardrail (0 of 17 for each of seven rewrites). Rewrites that change how the first word is spelled without changing what the shell runs evaded it often: empty quotes and backslash insertion 12 of 17 (71%), variable indirection 10 of 17 (59%), command substitution 6 of 17 (35%). Pooled over the 11 behaviour-preserving rewrites, 40 of 187 flagged commands (21.4%, 95% CI 16.1–27.8%) were no longer flagged, and 12 of the 17 patterns could be evaded by at least one rewrite. Two channel effects were larger than any rewrite: a caller-supplied read-only hint made all 17 commands run unprompted in every mode, including the look-only mode, and routing the same command through a connector-style tool name removed the guardrail's verdict entirely. We argue that pattern guardrails are a useful tripwire but not a security boundary. Enforcement belongs where the action is mediated: in a parser-normalised policy, in capability-scoped tools and in the sandbox. Code, logs and derived data to reproduce every number are in the attached archive. Preprint, not peer-reviewed.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-25
DOI
https://doi.org/10.5281/zenodo.24543106
Primary Topic
Security and Verification in Computing
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Matching Text Is Not Mediating Action: A Mutation Study of a Pattern-Based Command Guardrail in a Tool-Using LLM Agent

Akil Hassane
Zenodo (CERN European Organization for Nuclear Research)
Security and Verification in Computing
preprint

Matching Text Is Not Mediating Action: A Mutation Study of a Pattern-Based Command Guardrail in a Tool-Using LLM Agent

Akil Hassane
preprint en

Abstract

Tool-using LLM agents often rely on a deterministic guardrail that inspects each proposed tool call before it runs. A typical design matches shell commands against a block list and a confirm list of regular expressions, and combines the verdict with a user-selected permission mode. Such a guardrail is easy to audit, but it matches text, while the shell executes after quote removal, escape processing and parameter expansion. We measure the size of this gap on the production guardrail of a multi-agent platform. We use no LLM and execute no command. We mine all 26 flagged command literals from the project's own test suite, which cover 17 of its 34 patterns. Each literal is passed through 13 rewrites plus the identity, and we record the guardrail's verdict and the permission gate's decision under four modes. Separately, we check each rewrite on a benign command in bash and sh, and only rewrites that keep the command's behaviour count as evasions. Rewrites at the whitespace, wrapper and command-chaining level never evaded the guardrail (0 of 17 for each of seven rewrites). Rewrites that change how the first word is spelled without changing what the shell runs evaded it often: empty quotes and backslash insertion 12 of 17 (71%), variable indirection 10 of 17 (59%), command substitution 6 of 17 (35%). Pooled over the 11 behaviour-preserving rewrites, 40 of 187 flagged commands (21.4%, 95% CI 16.1–27.8%) were no longer flagged, and 12 of the 17 patterns could be evaded by at least one rewrite. Two channel effects were larger than any rewrite: a caller-supplied read-only hint made all 17 commands run unprompted in every mode, including the look-only mode, and routing the same command through a connector-style tool name removed the guardrail's verdict entirely. We argue that pattern guardrails are a useful tripwire but not a security boundary. Enforcement belongs where the action is mediated: in a parser-normalised policy, in capability-scoped tools and in the sandbox. Code, logs and derived data to reproduce every number are in the attached archive. Preprint, not peer-reviewed.

Zenodo (CERN European Organization for Nuclear Research)
Security and Verification in Computing
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon