TL;DR
When we give Large Language Model (LLM) agents the keys to our emails, databases, and payment APIs, a single prompt injection can lead to unauthorized actions or leaked secrets. SecureClaw solves this by treating the LLM runtime as completely untrusted—stripping it of raw sensitive data and direct API access—so the agent can still plan complex workflows using safe placeholders while trusted external components handle the actual secrets and execution.
What Problem Does This Paper Address?
Imagine hiring a brilliant personal assistant who occasionally gets hypnotized by spam emails. That is the reality of modern tool-using LLM agents facing indirect prompt injection, where malicious instructions hidden inside retrieved data hijack the agent's behavior.
When an agent is compromised, two distinct disasters can happen:
- The Effect Surface: The agent executes an unauthorized action in the real world (e.g., wiring money to an attacker or deleting a file).
- The Plaintext Surface: The agent reads sensitive raw data (like an invoice or medical form) and leaks it—not just in its final reply to the user, but through internal channels like shared memory or messages to other agents.
Existing defenses usually guard only one door. Checking actions right before execution stops rogue API calls, but it cannot "un-read" a secret the LLM has already stashed into shared memory. Conversely, trying to police data flows inside the LLM runtime still places too much trust in a compromised planner. The authors ask: how do we secure both surfaces simultaneously without breaking the agent's ability to get work done?
Methods
SecureClaw introduces a dual-boundary architecture that wraps around the native LLM tool-calling loop, treating the agent runtime as potentially adversarial.
- The Read Path (Reference IDs & Declassification): When a tool fetches sensitive data, a Trusted Gateway intercepts it, locks the raw plaintext in a Trusted Data Store, and hands the LLM an unforgeable placeholder token—a reference ID (like
INV_42). Because an agent can't plan completely blind, the gateway also generates a short, deterministic planning summary (e.g., "vendor A, amount $4.2k, due Friday"). Using fixed schema rules rather than an LLM, this acts as an explicit declassification channel: releasing just enough sanitized metadata to reason over, while keeping raw secrets out of the runtime. - The Write Path (
PREVIEW → COMMIT): The LLM cannot trigger external APIs directly. Instead, it proposes an action using its reference IDs. The gateway packages this with authenticated session context into a canonical request and asks a Policy Engine for a cryptographically bound approval digest. Finally, a Trusted Executor—the only component wired to external APIs—independently recomputes the digest, checks for replay attacks, resolvesINV_42back into real data, and executes the action. If a hijacked runtime tampers with the recipient after preview, the cryptographic binding breaks and the commit fails closed. - Deny-Aware Recovery: Security systems that simply crash on a blocked action ruin productivity. When SecureClaw denies an unsafe request, it returns a fixed-template hint suggesting a safe alternative (like "save a draft and request approval"), allowing the workflow to recover gracefully.
Datasets
Rather than training a new model, the authors evaluate SecureClaw across three established agent security benchmarks (plus a custom 29-scenario adversarial bypass suite):
- AgentDojo and Agent Security Bench (ASB): Dynamic environments that test whether prompt injections can trick tool-using agents into performing unauthorized external actions.
- AgentLeak: A multi-agent benchmark designed to catch data exfiltration not only in final user responses (channel C1), but also across internal inter-agent messages (C2) and shared persistent memory (C5).
Key Insights and Ideas
- Action guards and data confinement cannot substitute for one another: Ablation experiments prove that blocking bad API commits leaves internal memory and inter-agent chat wide open to secret leakage, while hiding plaintext via reference IDs does nothing to stop a compromised runtime from firing off unauthorized zero-argument tool calls. You need both boundaries.
- Agents don't need raw secrets to plan: Replacing sensitive payloads with opaque reference IDs and rule-based summaries keeps inter-agent messages and memory purely symbolic, starving attackers of raw data to exfiltrate.
- Graceful denials preserve utility: High security doesn't require turning the agent into a brick wall. Giving safe, structured fallback hints after a blocked commit recovers massive amounts of task utility without relaxing security invariants.
Key Results
Evaluated in a common test harness using gpt-4o-mini against four baselines (Plain, IPIGuard, DRIFT, and Faramesh), SecureClaw is the only defense that secures both surfaces while keeping the agent useful:
- Near-zero unauthorized actions: SecureClaw achieves a 0.00% Attack Success Rate (ASR) on ASB (retaining 88.90% task utility, compared to 3.70% for the next most secure baseline, Faramesh) and 0.64% ASR on AgentDojo.
- Shutting down internal leaks: On AgentLeak, SecureClaw slashes overall data leakage from 93.95% (unprotected) down to 3.23%, reducing shared-memory (C5) leaks to 0.00% and inter-agent (C2) leaks to 0.20%.
- Recovery & Overhead: Deny-aware recovery boosts matched-sample utility from 70% to 86% on ASB and 40.0% to 66.7% on AgentLeak at 0% ASR cost. Local policy checks add just ~15 ms of latency (or 149 ms in an optional distributed privacy mode)—negligible next to 500–2000 ms LLM inference calls.
Limitations and Future Work
SecureClaw enforces policy, not human intuition. Its remaining failures (such as the 4/629 cases on AgentDojo) happen when an attacker tricks the agent into performing an action that the policy technically permits—like applying an allowed workspace edit to the wrong object—alongside benign-utility drops (60.82% vs. 70.10% unprotected on AgentDojo) when coarse rules block valid edge cases. Furthermore, the system relies on complete mediation: if a developer forgets to route an external API through the executor or misclassifies a sensitive schema field, the guarantees evaporate. Future work points toward richer, fine-grained policy bindings (tying principals, objects, and workflow phases together) and tighter declassification budgets for planning summaries.
Summary updated