NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Where Agent Defenses Fail: A Case Study of Policy Compositions and Measurement Limits

Kunwar Sangram Singh, Krishna Mohan Guda Nagavenkata SrinivasaarXiv 2026

TL;DR

Imagine locking a coding agent in an air-gapped room so it can't leak secrets, then hiring a courier to mail its status reports to an approved address. If an attacker tricks the agent into slipping a password into that report, the courier happily delivers it anyway. This paper dissects how security layers interact—and quietly undermine each other—proving that where a message goes is very different from what it carries, and that we must measure security by checking actual delivered bytes rather than trusting defense logs.

What Problem Does This Paper Address?

When we give AI agents tools to read files, run shell commands, and make web requests, we expose them to indirect prompt injection: malicious instructions hidden inside everyday data like a README file.

To stay safe, engineers usually layer defenses:

  1. Proposal-side guards inspect the tool call the model wants to make before it happens.
  2. Runtime sandboxes lock down the execution environment (e.g., blocking all internet access and making sensitive files read-only).

Here is the catch: a completely offline sandbox prevents the agent from doing useful networked tasks, like uploading a legitimate status summary. To restore utility, systems introduce a host mediator—a trusted component outside the sandbox that forwards guard-approved requests on the agent's behalf.

Figure 1: The encoded-attestation follow-up illustrates the composition problem, not an exact primary- pilot trajectory. The legitimate task requires delivery, whereas the attacker adds a secret to the payload. A proposal-side guard can inspect that payload, while a restrictive sandbox can deny native network access. Host mediation creates a separate delivery path whose authorization must cover the payload as well as its destination. The paths shown are alternative configurations, not retries after a failed sandbox request. This mechanism overview omits the primary cohorts’ harness prechecks.

Prior benchmarks test guards and sandboxes, but rarely isolate what happens when you compose all three. What happens when an agent legitimately needs to read a secret .env file for configuration, gets hijacked by a prompt injection, and stuffs that secret into a payload headed for an approved destination?

Methods

Instead of inventing a new defense primitive, the authors build a rigorous, forensic-style testbed around a ReAct coding agent powered by a local open-weight model (gemma4:latest).

They trace tool calls across five core configurations (B0 through B4), mixing local resource guards, network-disabled Docker sandboxes, and host mediation:

Figure 3: The five pilot configurations, shown separately. The runtime boundary governs execution; the host mediator is a separate delivery path, not a network opening in the sandbox. In B4, the line check applies to http post bodies, not arbitrary shell traffic. Dotted links indicate measurement rather than execution. All rows use an outer container; only B2–B4 add restrictive runtime policy and dispatch prechecks. The omitted prechecks can refuse calls before any resource-access attempt.

What sets this methodology apart is independent effect-level measurement. Rather than trusting a guard’s log saying "I blocked the attack," an independent observer plants fresh synthetic secret tokens ("canaries") before each run, snapshots file hashes, and inspects actual HTTP receipts arriving at local servers.

The authors also test real-world open-source tooling—combining SafeAgents (a scanner and LLM-judge proxy) with OpenShell (a restrictive runtime)—and experiment with strict publication contracts that validate exact payload contents before the host mediator sends anything.

Datasets

No training datasets were used. For evaluation, the authors avoided massive, noisy benchmarks in favor of small, controlled, custom-authored repository tasks ("fixtures") where prompts, malicious injections, and evaluation rules were frozen prior to execution:

  • Prospective Pilot (110 runs): 7 injected attack scenarios (hidden in READMEs, contributing guides, shell scripts, and tool outputs) and 4 benign tasks.
  • Prospective Tier A (300 runs): An expanded suite of 18 attack and 12 benign tasks.
  • Supporting Cohorts: A 72-run Boundary study (testing base64 encoding and file aliases), a 24-run Named-backends test, an 80-run SafeAgents/OpenShell study, and 16 runs testing Publication Contracts. (Note: the authors mention adapted AgentDojo probes only as separate diagnostics in the appendices).

Key Insights and Ideas

  • Destination authorization $\neq$ payload authorization: Approving where an HTTP request goes does nothing to verify what is inside it. When a host mediator bridges a sandbox's network gap, it inherits whatever payload blind spots the guard has—a classic "confused deputy" problem.
  • String matching plays whack-a-mole with data formats: Blocking outbound requests that contain full lines from a .env file (CANARY_TOKEN=xyz) works until the agent extracts just the raw value (xyz) into a JSON field, or base64-encodes it.
  • Measurement tools have blind spots too: In the boundary study, the authors' own frozen detector missed three leaked secrets because of how they were base64-encoded—only caught later via post-hoc decoding. Furthermore, aggregate "task success" scores hid the fact that different defenses caused completely different action-level refusals.
  • Overly strict payload rules break benign work over tiny formatting quirks: Locking down a mediator to only allow an exact public template stopped attacks, but also rejected legitimate agent uploads simply because the model wrote a literal \n instead of an actual newline byte (0x0a). Normalizing whitespace and separators fixed benign utility without letting secrets slip through.
  • LLM judges fail silently on token budgets: In the SafeAgents/OpenShell runs, 12 judge evaluations threw JSON-extraction errors and failed closed. A replay diagnostic revealed why: the model spent its entire 256-token budget "thinking" (reasoning tokens) before outputting a verdict!

Key Results

  • The Sandbox vs. Mediation Tradeoff: In the 110-run pilot, baseline attack harm was 7/14. A restrictive sandbox (B2) dropped harm to 0/14, but cut benign task success to 6/8 (and 12/24 in Tier A) by blocking legitimate uploads. Adding host mediation (B3) restored benign utility (8/8 and 24/24), but reopened the leak (2/14 and 4/36 harm).
  • Evading Line Checks: Adding a complete-line substring filter (B4) yielded 0/14 harm and 8/8 utility in the pilot. However, in the 300-run Tier A cohort, 2/36 attacks bypassed it by stripping the CANARY_TOKEN= prefix and sending only the secret value.
  • External Guard + Runtime Composition: Across 68 valid runs in the 80-run SafeAgents/OpenShell cohort, baseline harm was 10/12. SafeAgents alone had 4/8 harm; restrictive OpenShell dropped harm to 0/12 (at 2/4 benign utility). Combining them with host mediation restored 4/4 benign utility, but leaked base64-encoded .env files in 2/7 valid attack runs.
  • Publication Contracts: An exact-match payload contract achieved 0/2 attack harm, but dropped benign utility to 0/2 due to newline formatting mismatches (while the agent falsely claimed success!). A normalized contract restored 2/2 benign utility while holding attack harm at 0/2.

Limitations and Future Work

The authors are refreshingly candid about what this paper is not: it is a bounded case study, not a general benchmark or a silver-bullet Data Loss Prevention (DLP) solution.

  • All experiments use a single agent architecture, a single local model (gemma4:latest), synthetic secrets, and non-adaptive, hand-written attacks with only two repeats per cell.
  • The independent observer has finite visibility—it truncates HTTP bodies at 64 KiB, doesn't inspect headers or uninstrumented channels, and misses transient file edits undone before a run finishes.
  • The normalized publication contract only works for one fixed public status message, not arbitrary semantic summaries.

Rather than proposing a new standalone product, the takeaway for future defense evaluations is architectural: stop evaluating sandboxes and guards in isolation, treat string normalization as a core part of security policy, and always audit the bytes that actually arrive at the destination.

Summary updated

BibTeX
@misc{singh2026where,
  author = {Kunwar Sangram Singh and Krishna Mohan Guda Nagavenkata Srinivasa},
  title = {{Where Agent Defenses Fail: A Case Study of Policy Compositions and Measurement Limits}},
  year = {2026},
  eprint = {2611.31541},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.31541},
}
Figure