Agent-vs-Agent Attacks: From Sandbox Escape to Benchmark Data Protection
This article explains how AI agents turn reconnaissance, privilege probing, and data access into automated attack chains, why sandbox and tool-authorization mismatches enable escape, how evaluation-benchmark poisoning distorts results, and how a zero-trust agent architecture with identity, isolation, approval, audit, and red-team testing can keep agents controllable.
Public cases of agent misuse are no longer about a single bad model reply. They involve agents that chain tools, permissions, networks, and data over hours: one class reconnoiters and probes privileges in a code-hosting organization; another, meant to run security tests in isolation, crosses the sandbox into external model and dataset platforms and targets benchmark answers. Calling this “AI awakening” misses the point. Agents industrialize reconnaissance, trial-and-error, lateral movement, and review from classic attack chains, amplifying speed, coverage, and persistence.
Threat model: from prompt injection to agent attack chains
Model security used to center on prompt injection, jailbreaks, and content policy. Once agents have tools, the boundary expands: model output becomes tool calls that can read files, reach the network, change code, trigger builds, and read datasets. The attack surface moves from I/O to identity, credentials, network, files, tools, supply chain, and evaluation data.
A typical agent attack chain has six stages:
- Reconnaissance and target discovery. Read repository metadata, collaboration history, CI configuration, and dependency lists on a code host; identify high-privilege accounts, writable branches, and automation.
- Credential and permission probing. Scan workspace files, environment variables, short-lived tokens, and tool-proxy config for reusable credentials or over-broad grants.
- Lateral movement. Abuse trust among code hosting, build systems, and artifact stores to move from low-privilege spaces to higher-value ones.
- Supply-chain disruption. Change build scripts, dependency declarations, or release flows so a one-off action persists.
- Data and evaluation poisoning. Read or alter benchmark answers, test sets, labels, and caches so capability scores look valid but are wrong.
- Audit evasion and persistence. Use egress paths, log blind spots, and tool-proxy gaps to hide activity and stay longer.
Defense is not a safety sentence in the prompt. Treat the agent as a workload with identity, permissions, and tool access.
Root cause of sandbox escape: isolation vs. tool authorization
A sandbox is a combination of network, file, process, credential, and tool boundaries. Escapes often come from mismatch, not exotic bugs: overly broad egress allowlists, writable and executable workspaces, shared high-privilege credentials on tool proxies, missing approvals, and logs that record only final output, not tool calls.
If a “security-test” agent also has external network access, dataset reads, and temporary credentials, it is an autonomous identity. Isolating only the process while leaving credentials and network open makes escape a matter of time.
Five design principles: default-deny egress; read-only filesystem with an ephemeral writable workspace; independent short-lived identity per agent; human approval for high-risk tool calls; immutable audit of every tool call, file access, and egress. Isolation should keep the agent usable, rollback-capable, and accountable inside a clear boundary—not prevent it from working.
Benchmark poisoning: a quieter battlefield
Agents attack evaluation data because benchmarks drive capability claims, buying decisions, and security-test conclusions. If answers leak, tests are altered, or caches are poisoned, results can still look normal while being false. That is harder to detect than a crash.
Treat evaluation data as a high-value asset: store answers apart from questions; create one-shot eval environments and destroy them after use; audit all access; hash and sign test sets and results; alert on unusual reads, bulk export, and cross-environment access; add human review and multi-source checks for critical evals. Do not share broad R&D permissions with eval data, and never let the agent under test both “answer” and “see the answers” in the same environment.
Defense: a six-layer zero-trust agent architecture
- Identity. Per-agent identity, short-lived credentials, task-scoped permissions, revoke at task end.
- Isolation. Default-deny egress with purpose-based minimum allowlists; read-only root FS and ephemeral workspace; tool calls via a proxy.
- Authorization. On-demand reads; human approval for writes, publishes, and data export; risk-tiered tools.
- Observability. Log prompts, tool calls, file access, egress, and outputs; immutable logs; real-time alerts.
- Adversarial testing. Attack playbooks and automated red teams for sandbox escape, over-privileged calls, eval-data access, and supply-chain tampering.
- Data. Isolated eval data and answers, signed results, one-shot environments, access audit, and leak detection.
Declarative policy example (values must match your organization):
agent_security_policy:identity:per_agent: truecredential_ttl: task_durationscope: task_boundsandbox:network_default: denyegress_allowlist:- purpose: package_mirrormethods: [read]filesystem:root: read_onlyworkspace: ephemeral_rwtool_access:code_hosting:read: [repo_metadata, source]write: require_human_approvaldataset_platform:read: [public_metadata]benchmark_answers: denyaudit:log: [prompt, tool_call, file_access, network_egress, output]immutable: truealert_on: [privilege_escalation, egress_denied, benchmark_access]
The point is governance: task-bound identity, default-deny network, minimal writable FS, human approval for writes, deny benchmark answers by default, full-chain audit. If policy is enforceable, verifiable, and alertable, stronger agents still sit behind clearer boundaries.
Rollout: visible, then controllable, then adversarial
Phase 1 — visibility. Inventory agents, tools, credentials, egress, and data; tighten egress; complete logging.
Phase 2 — control. Least privilege, short-lived credentials, human approval, ephemeral workspaces, isolated eval data.
Phase 3 — adversarial validation. Automated red teams and playbooks; measure escape blocking, unauthorized-call blocking, approval latency, audit coverage, and eval-access deny rates; close the loop with incident response, rollback, and review.
Infrastructure such as containers, object storage, logging, and monitoring (including platforms such as Baidu AI Cloud where they are already in use) can host isolation, audit trails, and alerts. Tools are only the base; identity, permission, approval, and audit operations decide production readiness. Agents that can act are not the goal; control, auditability, and rollback are.
