On April 13, 2026, Wei Zhao, Zhe Li, Peixin Zhang, and Jun Sun published arXiv 2604.11790: "ClawGuard: A Runtime Security Framework for Tool-Augmented LLM Agents Against Indirect Prompt Injection." The paper introduces a framework that enforces a user-confirmed rule set at every tool-call boundary, transforming alignment-dependent defense into a deterministic, auditable mechanism. The code is publicly available at github.com/Claw-Guard/ClawGuard.

The timing is not accidental. Four days before the paper dropped, Akshay Chugh disclosed that the Vercel Plugin for Claude Code registered hooks sending bash command strings to telemetry.vercel.com, tied them to a persistent device UUID, used empty-string matchers that fired on all projects, and obtained consent through prompt injection rather than native UI. The Vercel incident is not a traditional vulnerability. Nobody stole credentials. But it demonstrates the exact class of problem that runtime defense addresses: a hook that fires broader than intended, collecting data the user did not explicitly consent to share, through a mechanism that circumvents native consent UI. Replace "telemetry" with "exfiltration" and the architecture is identical.

Why the Prompt Layer Is the Wrong Place to Defend

You can tune Azure Prompt Shield, Meta Prompt Guard, and a regex pipeline on top of both. A 2026 paper showed six commercial detectors can be evaded at up to 100% success rate using character injection and adversarial ML (arXiv 2504.11168). A systematization-of-knowledge study reached the same conclusion by a different route: no category of guardrail reliably stops prompt injection (arXiv 2506.10597). This is not a tuning problem. It is a layer problem.

The prompt layer is where the attacker wants the fight. Detectors read tokens. LLMs read tokens. Whatever transformation fools the detector but preserves meaning for the LLM wins. Runtime enforcement changes the arena. The attacker still has to manipulate tokens to influence the LLM, but the damage, a tool call to exfiltrate data, a write to /etc/passwd, a shell execution, happens outside the token stream. That is where a deterministic rule engine can stand.

Simon Willison's 2023 framing still holds: the only defenses we trust are the ones that do not rely on the LLM getting it right. ClawGuard is the 2026 version of that bet, applied at the tool-call boundary.

Three Injection Channels, One Enforcement Point

ClawGuard's threat model identifies three attack channels. Each is a live attack surface today.

Channel 1: Web and Local Content Injection

The agent reads a web page, a PDF, a search result, or a local file. Adversarial instructions are embedded there. The LLM processes them as if they were user intent. This is the classic indirect prompt injection pattern from the 2023 Greshake paper, now generalized to every tool that returns untrusted text.

Channel 2: MCP Server Injection

A compromised or malicious Model Context Protocol server embeds instructions in tool descriptions or response payloads. The agent reads those instructions as context and acts on them. Anthropic's own Git MCP server had three CVEs in January 2026 (CVE-2025-68143/68144/68145) enabling arbitrary file access and RCE through this pattern. Blake Crosley's 50-vulnerability catalog of MCP servers documents this channel extensively.

Channel 3: Skill File Injection

Skills, in the Claude Code and Copilot Extensions model, combine natural-language behavioral directives, tool invocation templates, and capability descriptions in a single config file. A malicious skill is effectively a persistent, structured prompt injection with tool privileges attached. On February 25, 2026, Check Point disclosed a Claude Code issue where a poisoned .claude/settings.json hook achieved RCE the moment a developer opened the repository.

All three channels share a structural property: the hostile signal enters the LLM's context through a tool, and the damage happens through another tool call. That geometry is why tool-boundary enforcement catches them all with one mechanism.

How ClawGuard Works

ClawGuard operates in two phases.

Phase 1: Rule Generation (Before Any Tool Use)

ClawGuard extracts the user's stated objective and automatically generates a rule set. This happens before any external tool invocation, which means untrusted content cannot contaminate the rules themselves. A malicious web page cannot quietly add attacker.com to the whitelist because by the time the agent sees the page, the whitelist is already sealed.

The rule set has two parts:

Baseline rules (R_base). Non-negotiable security invariants. Deny shell rm -rf /. Deny writes to ~/.ssh. Deny network calls to private IP ranges. Deny reads of /etc/shadow. These load before the user's task is known.

Task rules (R_task). Induced by the LLM from the user's stated objective. For "summarize the latest issues in my repo," the induced rules whitelist the repo's git domain and working directory, and blacklist every other network destination and path. The user sees this rule set and can edit it.

The critical ordering detail: rule induction happens before the agent reads any tool output. Untrusted content cannot influence the rules because the rules are locked before untrusted content enters the context.

Phase 2: Runtime Enforcement (Every Tool Call)

At each tool-call boundary, four components run:

Component What It Does Failure Mode Without It
Content Sanitizer Redacts credentials, API keys, SSH keys from arguments and returns via regex/glob Secrets leak to tools or into the model's context window
Rule Evaluator Checks tool invocations, file paths, and network destinations against the rule set Agent calls sendemail([email protected], SSHKEY) and it runs
Skill Inspector LLM-judge risk scores each skill; user confirms before first use Skill files smuggle behavioral directives with no gate
Approval Mechanism Ambiguous calls route to a human; every event is logged Silent escalation, no audit trail

The Rule Evaluator returns three verdicts: allow, deny, or ambiguous. Ambiguous routes to the user. This matters because "ambiguous" is where most real systems fail. They either block everything, utility collapses, or allow everything, security collapses. ClawGuard separates the decision.

The Numbers That Matter

ClawGuard evaluates on three benchmarks across five frontier LLMs.

Benchmark Baseline ASR With ClawGuard Utility Retained
AgentDojo 0.6-3.1% 0.0% 98.1-100% completion
SkillInject 26-48% 4.8-14% 50-84% relative ASR drop
MCPSafeBench 36.5-46.1% 7.1-11.2% 82.0-86.8% completion

Two observations. First, AgentDojo baseline numbers look low because most frontier agents have decent passive resistance to AgentDojo's attacks. ClawGuard closes the remaining gap to zero. For context, PromptArmor reports 0-0.47% on AgentDojo using a guardrail LLM (arXiv 2510.05244), and CaMeL reports 67% attack neutralization with 77% task completion (arXiv 2503.18813). ClawGuard achieves the perfect AgentDojo number while keeping completion at 98%+ without dual-LLM overhead.

Second, the MCPSafeBench numbers tell the more important story. MCP-server injection baselines sit at 36-46%. That is what unguarded agents look like against compromised tool servers. ClawGuard brings that down roughly 4x. The residual 7-11% is exactly where a second control layer should stack.

ClawGuard also tracks an Implicit Resistance Rate: the fraction of defense outcomes that are explicit refusals versus probabilistic model resistance. Without ClawGuard, only 9-16% of survived attacks are explicit refusals. The rest are silent luck. That number is why security teams are nervous about model-level defenses. You cannot audit what you cannot observe.

Where This Fits in the Defense Stack

ClawGuard is not a standalone answer. It is one layer in a multi-layer stack that is starting to look coherent in 2026.

Layer Examples What It Catches
Input detection Azure Prompt Shield, Meta Prompt Guard Obvious injection text (fails on adaptive attacks)
Privilege separation CaMeL (dual LLM + sandboxed interpreter) Control-flow hijacking via untrusted data
Runtime tool enforcement ClawGuard Disallowed side-effects at the tool boundary
Causal attribution AttriGuard Tool calls caused by untrusted content, not user intent
Behavioral monitoring AgentWatcher, trajectory analyzers Patterns that look like multi-step exfiltration
Post-hoc output sanitization Markdown renderers, URL rewriters Exfiltration via generated links/images

ClawGuard slots into Layer 3, the enforcement boundary between "the LLM decided to do X" and "X actually happens." Miss this layer and the four layers on either side are doing work they were not designed for.

From Paper to Practice: What Practitioners Already Have

ClawGuard formalizes something practitioners have been building informally. Claude Code ships with a hook system that supports PreToolUse and PostToolUse interception. Practitioners like Blake Crosley run 95+ hooks enforcing file path restrictions, validating tool inputs, and gating destructive operations behind explicit confirmation.

The gap between these hand-written hooks and ClawGuard's vision is automation. Hand-written rules cover the attacks you anticipated. Derived constraints could cover attacks you did not anticipate, because they operate on the positive set (what should happen) rather than the negative set (what should not). Whether automatic derivation works reliably in production remains an open question. The benchmarks are controlled environments. Real agent sessions involve ambiguous tasks, multi-step tool chains, and tool calls that look anomalous but are legitimate. False positives that block valid tool calls erode the utility claim quickly.

Limitations and Open Questions

The rule generation step still relies on an LLM, which introduces a potential failure mode. What if the rule generator itself is compromised or produces overly permissive rules? The paper does not deeply explore adversarial rule generation.

The residual SkillInject rate of 4.8-14% is not a failure. It is the honest floor for context-dependent attacks where damage happens inside generated text rather than through an explicit side-effect. Pair it with output-level checks like markdown rendering sanitization and data-exfiltration monitors, not with more input detectors.

The benchmarks are relatively new and may not capture all real-world attack sophistication. The utility preservation claim needs scrutiny in production settings with complex, multi-step tasks.

The approach assumes users can meaningfully review and understand generated rules. This may not scale to complex tasks with many tool interactions.

What This Means for Your Architecture

If you are building a tool-augmented agent in 2026, the honest architectural position is that your LLM will be prompt-injected. The question is what that does to the system.

Stop treating detectors as the gate. An input classifier is a signal, not a barrier. It belongs in the telemetry pipeline and the WAF, not in the critical path.

Make the tool boundary the gate. Every tool call goes through a rule engine that evaluates whether the destination is in the session whitelist, whether arguments are free of sanitizable secrets, and whether the call's side-effect class matches the trust level of whatever caused it. This is independent of what the LLM thinks it is doing. It is the iptables of agents.

Derive constraints from the user's task, not from a static policy. A static policy that covers every tool an agent might call is either too loose or too tight. Task-scoped rules, induced once before tool execution, give you the right permission window for the current session only.

Confirm rules before execution and log every decision. The user-confirmed rule set is not ceremony. It is the audit trail. Compliance auditors want a record of what was allowed, denied, and overridden. Runtime enforcement produces that record naturally. Prompt-layer detection does not.

Accept that residual risk stays non-zero. ClawGuard's residual SkillInject rate is the honest floor. Stack additional controls at the output layer, not more input detectors.

The Bigger Picture

ClawGuard represents a shift in how the field thinks about agent security. The 2023 conversation was about making prompts harder to inject. The 2025 conversation was about detecting injections in context. The 2026 conversation is about what happens after the injection succeeds. Because it will succeed. The question is whether the system lets the injection cause real-world damage.

The answer, increasingly, is that the tool-call boundary is the place to enforce policy. It is deterministic. It is auditable. It does not depend on the model being smarter than the attacker. It operates at the same layer as traditional access control mechanisms in every other computing domain.

ClawGuard is not the final word. The automatic constraint derivation component is future work. The benchmarks are controlled. The residual attack rates on SkillInject and MCPSafeBench show that runtime enforcement alone is not sufficient. But it establishes the principle clearly: deterministic tool-call boundary enforcement is an effective defense mechanism for agentic AI systems, requiring neither safety-specific fine-tuning nor architectural modification.

The field is converging on this insight from multiple directions. CaMeL proposes privilege separation with dual LLMs. AttriGuard traces causal attribution to untrusted content. AgentWatcher monitors behavioral patterns. ClawGuard enforces constraints at execution time. None of these are sufficient alone. All of them are necessary.


ClawGuard: A Runtime Security Framework for Tool-Augmented LLM Agents Against Indirect Prompt Injection. Wei Zhao, Zhe Li, Peixin Zhang, Jun Sun. arXiv 2604.11790. April 13, 2026. Code available at github.com/Claw-Guard/ClawGuard.