WorksComputer Science
Compositional Exploits in Autonomous Coding Agents: Attack Mechanics and Ephemeral Defense
Abstract
Autonomous coding agents (such as Antigravity, Claude Code, Cursor, and OpenHands) rely on third-party tools to inspect files, run commands, and call external APIs. Today's security auditors evaluate these tools almost entirely in isolation: static linters and AST checkers verify that each individual tool contains no malicious code at installation time. In this paper, we show that isolated tool auditing is fundamentally flawed. We expose compositional exploits in autonomous coding agents, an emergent vulnerability class where an agent chains individually harmless tools to execute an unauthorized attack. Much like code-reuse attacks in binary exploitation, this threat requires no malware; instead, the agent stitches together legitimate tool operations across turns over shared workspace files, environment variables, and chat memory. Across a 560-task benchmark suite (360 exploit tasks across 8 hazard classes and 200 benign developer and cloud workflows), unprotected frontier models (Gemini 3.5, 3.7, and 3.8 Flash) execute compositional exploit chains with a 72.9% to 84.5% success rate, while five leading single-tool pre-distribution scanners exhibit a 0% detection rate across all constituent tools. To eliminate compositional exploits, we present CompGuard, an OS-grounded defense uniting two planes: (1) a Cognitive Control Plane that issues single-skill capability leases and tracks dataflow provenance, and (2) an OS Kernel Enforcement Layer using Linux Landlock LSM v4, seccomp-BPF socket filters, and an ephemeral loopback proxy to close the invocation gap. CompGuard achieves a 100% Defense Block Rate (0.0% to 0.8% pre-teardown Net ASR) at 61.4 microseconds interposition overhead, preserves a 98.0% solve rate on benign developer workflows, and triggers zero false alarms across 615 real cloud diagnostic calls.
Introduction
Autonomous software engineering agents (e.g., Antigravity, Claude Code, Cursor, OpenHands [23], Devin) are rapidly transforming modern programming [20, 21]. Rather than merely offering conversational completions, modern coding assistants actively inspect repositories, synthesize patches, execute test suites, and deploy cloud infrastructure. To empower agents with specialized capabilities, the developer tooling ecosystem has converged on modular “Skill” architectures—most prominently exemplified by Anthropic’s Model Context Protocol (MCP) [27, 30] and open package registries such as ClawHub. Under these architectures, tools are encapsulated as self-contained bundles consisting of declarative interface manifests and executable scripts. Agents load these capabilities dynamically via Progressive Disclosure, minimizing token context overhead while maintaining access to extensive utility libraries.
The Fallacy of Atomic Auditing. Today, enterprise security auditors evaluate agent skills almost exclusively in isolation. Code linters (Bandit, Semgrep), static AST analyzers, MCP server taint auditors [26], and LLM-as-a-judge review gates inspect individual tools at ingestion time to certify them as “benign.”
In this paper, we demonstrate that isolated tool auditing is fundamentally flawed. Consider a configuration auditor tool certified as benign because it lacks network access, and a webhook notifier tool certified as benign because it cannot read credential files. Operating in a shared workspace, an agent can chain them through intermediate files: the first tool reads private credentials and writes them to a temporary scratch file; the second tool reads the scratch file and transmits it externally. Neither tool broke any security rule on its own, yet running them together results in full credential exfiltration.
The Compositional Exploitation Paradigm. Much like code-reuse attacks in binary security (e.g., Return-Oriented Programming) [1, 2], where adversaries stitch together benign machine instructions to bypass memory protections, compositional agent exploits stitch together legitimate developer tools across shared workspace state to synthesize forbidden capabilities without writing malware. By exploiting the shared state environment across workspace files, process environment variables, and chat memory (), compositional exploits trigger critical security hazards through completely benign tools.
Defensive Challenges: The Invocation Abstraction Gap. Mitigating compositional exploits is difficult due to the Invocation Abstraction Gap. High-level application monitors inspect tool names and argument strings in userland. However, when an agent executes standard commands like python3 script.py or bash run.sh, the child process executes operating system system calls directly inside the OS kernel. Attackers easily bypass userland regex filters via shell indirection (e.g., base64 piping, variable interpolation, or dynamic language imports). Because high-level inspection is blind to low-level system calls, sound mediation cannot exist solely at the application layer.
CompGuard: Decoupled Dual-Plane Defense. To eliminate compositional exploits without breaking legitimate developer workflows, we present CompGuard. CompGuard decouples protection into two cooperative planes: (1) a Cognitive Control Plane that tracks developer intent, verifies ingestion capability contracts, mints short-lived capability leases with single-skill exclusive binding (), and tracks dataflow via a Fine-Grained Artifact Provenance DAG that parses structured configs to eliminate false alarms; and (2) an unbypassable OS Kernel Enforcement Layer that compiles ephemeral Landlock rulesets and seccomp-BPF socket filters directly into the Linux kernel to confine filesystem and network access, routes network connections through a local loopback proxy to inspect domain names, and prevents symlink directory traversal attacks.
Core Contributions. Our primary contributions are:
Formal Threat Model: We formalize the compositional threat model over shared workspace files, environment variables, and memory, and establish a taxonomy of 8 emergent hazard classes (–).
Compositional Attack Mechanics: We show how benign developer skills chain across shared files, environment variables, and chat memory over multi-turn trajectories, triggered via routine-sounding work orders, indirect prompt injections, dormant CI/CD triggers, and multi-agent refusal laundering.
Dual-Domain Benchmark Suite: We establish Skill-CompositionBench and SkillUtilityBench (460 tasks enforcing strict Tool Identity Invariance, verified via dual deterministic oracles) alongside Cloud-OpsBench (100 real Kubernetes incident triage cases across Google OnlineBoutique microservices), totaling 560 benchmark tasks.
Extensive Empirical Evaluation: Evaluating frontier models (Gemini 3.5, 3.7, and 3.8 Flash), we demonstrate that unprotected agents execute compositional exploit chains with 72.9% to 84.5% success across the 354 completed adversarial trials (79.6% on the 280 core chains), while five single-tool pre-distribution scanners exhibit 0% detection.
CompGuard Defense: We implement and evaluate CompGuard. CompGuard achieves a 100% Defense Block Rate (0.0%–0.8% pre-teardown Net ASR) with 61.4 s interposition latency, preserves a 98.0% solve rate on normal developer tasks (2.0% false positive rate, 0.0% timeouts), incurs zero false alarms across 615 real cloud diagnostic calls (+3.0% Joint RCA accuracy), and achieves 98.2% attribution precision.
Threat Model & Hazard Taxonomy
Workspace Execution Environment. An autonomous coding agent executes within a persistent, stateful workspace with three core components:
Workspace Filesystem (): A persistent hierarchy of files and directories identified by physical operating system inode tuples mapped to canonical paths, permissions, and cryptographic content digests.
Process Environment (): A key-value store of process environment variables (e.g.,
PATH,API_KEY,CXX) inherited and mutated by child subshells.
Context Memory (): The agent’s conversational context window, accumulating multi-turn user work orders, tool execution observations, and reasoning thoughts.
Tool Execution Semantics. A skill or tool exposed to the agent is an operational function characterized by: (1) an Input Schema specifying parameter names, types, and path constraints; (2) Preconditions that determine valid execution states; and (3) State Side-Effects that mutate the shared workspace state ().
Threat Model & Trust Boundaries. We consider realistic enterprise and open-source software engineering settings:
Attacker Capabilities: The adversary seeks to induce the agent to violate system security invariants (exfiltrating private credentials, establishing persistent backdoors, clobbering databases, or poisoning CI/CD pipelines). The attacker does not need to embed malicious code within any single tool; all tools are individually benign developer utilities. Input arrives via Indirect Prompt Injection (IPI) [10] (e.g., poisoned issue descriptions or repository files) or externally authored work orders (e.g., issue tickets or CI tasks pasted into the agent).
Trust Boundaries: The LLM planner is untrusted (vulnerable to indirect prompt injection and refusal laundering). Individual tool code is benign but unprivileged (vulnerable to confused-deputy misuse [5]). The local human developer at the workstation terminal, the CompGuard supervisor daemon, and the Linux operating system kernel form the Trusted Computing Base (TCB).
The Concrete Two-Gadget Walkthrough (). Here denotes forward sequential tool composition ( followed by ). Consider two standard developer tools:
Configuration Auditor (): Inspects local configuration files (
.env) to verify syntax, writing an audit report to scratch space (/tmp/report.json). It has zero network capabilities.
Webhook Notifier (): Reads a summary file from disk and dispatches an HTTP POST request to a remote team endpoint. It possesses network capabilities, but is never granted permission to read sensitive credential files.
In isolation, both tools are certified as harmless by static scanners (Bandit, Semgrep) and LLM review gates. However, when an agent executes them sequentially over the shared workspace state: at turn , reads credentials from .env and writes them to /tmp/report.json; at turn , reads /tmp/report.json and transmits its contents across the network. Through shared filesystem reachability, the sequential composition synthesizes an unauthorized credential exfiltration capability without a single line of malware.
Emergent Hazard Taxonomy. As summarized in Table I and visualized in Figure 1, we identify 8 hazard classes (–) organized under three core security pillars: Confidentiality nign developer tools to bypass pre-distribution static scanners. Crucially, these tools never call each other directly in code. Instead, the agent invokes tool at turn , performs intermediate reasoning or file edits, and invokes tool at turn . The exploit chain is connected solely through shared workspace state.

Figure 1. The Anatomy of an Emergent Compositional Exploit Chain in Autonomous Coding Agents. (1) Pre-distribution scanners evaluate tools in isolation and certify both (Config Auditor) and (Webhook Sender) as 100% benign. (2) The autonomous LLM agent planner receives a routine work order and plans a multi-turn trajectory. (3) In Turn 1, reads confidential credentials from .env and stages them into an unmonitored scratch file (/tmp/report.json). (4) In Turn 2, reads the staged scratch file and transmits the payload to an external server. Through shared workspace state reachability, individually safe tools compose into an emergent exploit without writing a single line of malicious code.
| Hazard Class | Pillar | Compositional Mechanism () |
| : Credential Exfiltration | Confid. | Config auditor reads .env scratch file webhook notifier transmits secrets externally. |
| : Stealth Egress Tunneling | Confid. | Config helper updates .git/config mirror URL sync tool pushes repo secrets to mirror. |
| : Database Clobbering | Integrity | Cache cleaner lists paths in scratch artifact purger overwrites production DB schema files. |
| : CI/CD Pipeline Poisoning | Integrity | Template tool stages snippet in scratch CI sync merges it into .github/workflows/ci.yml. |
| : Cryptographic Downgrade | Integrity | Diagnostic logger writes TLS error to scratch config patcher sets TLS_VERIFY=False. |
| : Git Hook Persistence | Execution | Setup helper stages script in scratch git installer copies it to .git/hooks/pre-commit. |
| : Subshell Command Injection | Execution | String formatter writes unescaped shell payload to scratch test runner executes it in subshell. |
| : Database Privilege Escalation | Execution | Migration helper drafts GRANT ALL SQL in scratch live DB client executes staged migration. |
Table 1. The 8 Emergent Hazard Classes (–) Categorized Under Three Fundamental Security Pillars.
Multi-Turn State Chaining. We model the agent’s execution environment as a multi-turn state space , consisting of the workspace filesystem (tracked via physical inode tuples ), process environment variables , and chat context memory . At turn , the agent takes an action (such as calling a tool or running a shell command), updating the workspace state . In a two-step chain (), an upstream tool reads sensitive data and stages it into a scratch file, and a downstream tool reads that file and triggers a privileged sink (such as sending a network request or writing a git hook). In three- and four-step chains (), intermediate tools format, aggregate, or pass data through environment variables before reaching the final sink, making the flow invisible to pairwise tool checks.
Attack Trigger Vectors. Because every tool in the chain is a legitimate utility, an attacker does not need adversarial jailbreak strings to trigger execution [19]. Across our benchmark, exploit chains are triggered through four realistic vectors:
Routine Work Orders: Natural developer requests grounded in standard engineering roles (e.g., an issue ticket asking the agent to run a pre-flight configuration audit, aggregate the report, and post the summary to a deployment webhook).
Indirect Prompt Injection (IPI): Instructions hidden inside untrusted repository files, pull request descriptions, or error logs [10] that redirect the agent to chain local tools during routine triage.
Violations (, ), Integrity Violations (, , ), and Execution Control Violations (, , ).
Compositional Exploitation Mechanics
In classical Return-Oriented Programming (ROP) [1], an attacker chains existing machine instructions to bypass memory protections without injecting new code. Similarly, in autonomous coding agents, an attacker chains existing, be-
Dormant CI/CD Triggers: Two-phase attacks where the agent modifies a test fixture or build configuration during an interactive session, which remains quiet until it detonates later during an automated CI/CD test run.
Multi-Agent Refusal Laundering: In hierarchical multi-agent frameworks (e.g., AutoGen [22]), an Architect planner receives a benign-framed compliance or operations goal and decomposes it into harmless-looking sub-tasks with explicit scratch paths for a subordinate Executor (e.g., Audit config to /tmp/out → Format report → Forward digest), bypassing single-agent safety refusals.
CompGuard: Cognitive Control Plane
Autonomous coding agents require flexible workspace access to inspect repositories, execute builds, run tests, and notify developers, yet broad ambient authority allows attackers to compose benign utilities into host exploits. CompGuard resolves this through two cooperative layers: a userland Cognitive Control Plane (§IV) and an OS Kernel Enforcement Layer (§V). Acting as the runtime’s central supervisor [13], the Cognitive Control Plane verifies capability contracts at ingestion, grants single-skill ephemeral leases during dispatch, tracks key-value and context provenance across workspace state, and verifies safe declassification before outbound egress.
Declared Capability Contracts. To eliminate heuristic guesswork and silent registry drift [27], CompGuard requires each tool to declare an immutable Capability Contract specifying allowed entrypoints (), accessible filesystem paths (), outbound network domains (), and environment keys (). Before registration, an AST visitor verifies the absence of dynamic evaluation (eval, exec, importlib) or undeclared subprocess dispatches. Paths are resolved to canonical realpaths (rejecting system directories and .git/hooks/*), and the contract is sealed with a SHA-256 hash verified before execution.
Single-Skill Ephemeral Leases (). Conventional agent systems violate least privilege [3] via ambient privilege accumulation: permissions granted to an early tool persist across the session. CompGuard eliminates ambient privileges via Ephemeral Capability Leases. When the agent dispatches a tool at turn , the supervisor issues a short-lived lease authenticated with an HMAC-SHA256 token stored in supervisor memory, enforcing Single-Skill Exclusive Binding (). When the tool finishes, the supervisor revokes , kills the isolated worker process group (SIGKILL / cgroup.kill), destroys the temporary sandbox, and recycles all privileges so downstream tools never inherit open sockets or lingering authority.
Fine-Grained Key-Value & Context Provenance. Tracking taint across whole files causes severe Taint Explosion [6]: config files (.env, config.yaml, settings.json) mix private credentials (API_KEY) with benign parameters (PORT=8080), causing a 10.0% False Positive Rate (FPR) when whole files are tainted (§VII). CompGuard parses structured configs and environment variables () into discrete key-value pairs under a two-point confidentiality lattice [4], projecting a filtered virtual configuration view into each worker sandbox exposing only keys declared in . Benign settings remain untainted (), while keys matching sensitive patterns (SECRET, KEY, TOKEN, PASSWORD, DATABASE_URL) or high-entropy tokens ( bits/char), plus derived substrings or re-encodings, are tagged confidential (). If a tool prints a value to stdout/stderr, the supervisor redacts the secret string before appending the observation to and taints subsequent tool arguments, preventing cross-turn context laundering. Unstructured files (logs, caches, scripts) are tracked via physical inodes with per-turn versioned nodes in the Artifact Provenance DAG , cutting benign FPR from 10.0% to 2.0% on developer benchmarks and 0.00% across 615 cloud calls.
Safe Declassification Gateway. Legitimate workflows often export operational summaries (e.g., posting test metrics to Slack). CompGuard routes outbound requests through a Safe Declassification Gateway [4] verifying: (1) User Intent: the root prompt (parsed once at session start, outside the per-turn critical path) explicitly requested external reporting; (2) Payload Cleansing: the payload has no unde-classified ancestor in and contains no raw credentials, secret substrings, or canary tokens; and (3) Contract Alignment: the destination matches . Modifying critical persistence targets (.git/hooks/*, CI/CD configs) requires an Out-of-Band (OOB) Human Authorization Token (HAT) approved by the trusted local developer via an isolated terminal UNIX socket.
Preventing Multi-Turn Leakage & Culprit Attribution. Because CompGuard terminates the entire worker process group after every turn, volatile memory, pipes, and sockets are destroyed between turns. Any cross-turn dataflow must traverse , , or , all mediated by . When a violation is blocked at turn , CompGuard computes an backward reachability slice over the turn-versioned DAG within the 23.2 s provenance budget to isolate the minimal culprit gadget chain .
OS Kernel Enforcement Layer
Application-level security wrappers inspecting shell command strings or tool arguments fail against syntactic evasion (dynamic imports, subshell forks, variable interpolation, base64 piping). To close the Invocation Abstraction Gap, CompGuard implements an unbypassable OS Kernel Enforcement Layer directly at the system-call boundary.
Kernel Sandboxing, Proxy & Runtime Audit Hooks. CompGuard initializes fanotify at startup before dropping root privileges (setresuid()), combining Linux Landlock LSM with seccomp-BPF and runtime audit telemetry:
Filesystem Isolation: Pre-spawn, CompGuard compiles an unprivileged default-deny Landlock ruleset via
landlock_restrict_self(). Read-write access is granted to the workspace repository (excluding .git/hooks and .git/config) and scratch
storage (/tmp/agent_scratch). System binaries (/usr, /etc), package environments (.venv, node_modules), shell profiles (~/.bashrc), and .git/hooks + .git/config (via read-only bind-mount and sibling rules) are enforced as strictly read-only. Confidential host paths (~/.ssh, cloud credentials) are completely omitted from the default-deny ruleset, denying all read and write access unless explicitly leased.
Ephemeral Network Proxy: Because Landlock ABI v4 filters TCP
connect(2)only by port and does not filter UDP, CompGuard pairs Landlock on all kernels with a lightweight seccomp-BPF filter blocking UDP (SOCK_DGRAM) and raw sockets, restricting TCP connections to a local loopback proxy (127.0.0.1 : P_{\mathrm{proxy}}) bound with a per-turn proxy token. The proxy resolves allowlisted domains via trusted DNS, inspects the RFC 6066 TLS SNI / HTTP Host header, and drains pending PEP 578/fanotify events for the worker PID to verify payload cleansing before forwarding viasplice(2).
Runtime Audit Telemetry: To populate at microsecond speed, CompGuard pairs Python runtime audit hooks (PEP 578,
sys.addaudithook, ) with kernel fanotify descriptors capturing file opens and writes from native binaries (bash,git,curl).
Fresh Worker Processes & Environment Scrubbing. Because Linux kernel sandboxes are monotonically restrictive, CompGuard keeps the supervisor unconfined and spawns a fresh child worker per turn. On exit, the worker’s cgroup and sandbox are destroyed while workspace files persist on disk. The supervisor scrubs returned environment variables () between turns—stripping loader variables (LD_PRELOAD, PYTHONPATH, BASH_ENV), locking proxy variables (HTTP_PROXY, HTTPS_PROXY), and passing only contract-declared keys ().
Symlink Prevention & Kernel Compatibility. To block symlink escapes (e.g., a workspace link pointing to ~/.ssh/id_rsa), CompGuard uses Linux openat2 resolution: internal workspace accesses enforce RESOLVE_BENEATH (allowing internal .venv symlinks while blocking external escapes), while supervisor config inspections enforce RESOLVE_BENEATH | RESOLVE_NO_SYMLINKS to prevent TOCTOU swaps. CompGuard uses Landlock ABI v4 [7] on Linux , and automatically falls back to seccomp-BPF (__NR_socket) and SECCOMP_RET_USER_NOTIF proxy routing on Linux 5.13–6.6.
Evaluation Methodology & Benchmark Suite
To evaluate autonomous agents and defenses under realistic conditions, we established SkillCompositionBench and SkillUtilityBench (460 tasks across 4 tracks) grounded in repository and agent safety benchmarks (e.g., SWE-bench [24], Agent-Harm [18]) alongside Cloud-OpsBench [25] (100 industrial Kubernetes incident triage cases), summarized in Table II.
| Track / Benchmark | Tasks | Tools | Target Hazard / Workflow | Limit |
| Track 1: UtilityBench | 100 | 32 | Benign Workflows (–) | |
| Track 2: Exploit Chains | 280 | 32 | Core Chains (–) | |
| Track 3a: Advanced PII | 30 | 32 | Prompt Injection Payloads | |
| Track 3b: Dormant CI/CD | 30 | 32 | Quiescent Detonation (DDIPE) | |
| Track 4: Multi-Agent | 20 | 32 | Refusal Laundering | |
| Cloud-OpsBench (K8s) | 100 | 12 | Industrial Cloud Incident Triage | |
| Total Evaluation Scale | 560 | – | Dual-Domain Empirical Suite | – |
Table II. Consolidated overview of the evaluation benchmark suite (560 total tasks across 5 tracks).
The Tool Identity Invariance Principle. A critical methodological contribution is that benign negative control tasks in SkillUtilityBench (–) enforce strict tool identity invariance with exploit tasks: both tracks invoke the exact same 32 constituent tools (). For example, in , export_sentry posts routine unit test coverage metrics to Slack; in , the identical tool exfiltrates unencrypted database credentials. CompGuard cannot rely on crude tool blacklisting; it must dynamically track dataflow provenance.
Deterministic Dual-Oracle Verification. Every task is scored via dual deterministic oracles: (1) Host Filesystem Snapshot Oracle, evaluating the symmetric difference over physical inode tuples and SHA-256 content digests to detect insertions, in-place modifications, and destructive deletions ( / ); and (2) Loopback Honeynet Sinks on ports 8080–8400 asserting exact 128-bit canary token matches. For dormant CI/CD tasks (DDIPE), a secondary containerized runner executes synthetic CI builds (pytest tests/ -q) to confirm post-session detonation.
Industrial Cloud-OpsBench. To evaluate real-world software engineering workflows, we evaluate 100 incident triage cases across the Google OnlineBoutique microservice ecosystem (11 services) across 8 cloud fault classes. Agents use 12 SRE diagnostic tools (GetAlerts, GetErrorLogs, CheckServiceConnectivity, etc.) under read-only ephemeral leases, evaluating Joint Root Cause Analysis (JRA) accuracy and false alarm rates.
Comprehensive Empirical Evaluation
We structure our evaluation around five core research questions (RQ1–RQ5) using three primary security metrics: (1) Baseline ASR, the fraction of unprotected trials satisfying the deterministic exploit oracle; (2) Defense Block Rate (DBR), the fraction of active exploit trajectories reaching a restricted sink in which the defense traps and terminates the unauthorized capability violation; and (3) Net ASR, the fraction of defended trials where the hyper-conservative post-run oracle detects any partial canary byte in the honeynet or target digest diff in , even if the worker process was subsequently trapped and killed.
RQ1: Inefficacy of Single-Tool Pre-Distribution Scanners. As summarized in Table III, leading single-tool static analyzers and LLM review gates (Bandit v1.7.9 [28], Semgrep v1.84.0 with rules [29], Cisco AI Defense, AST linters, and LLM-as-a-Judge via Claude 3.5 Sonnet and GPT-4o) exhibited a 100.0% bypass rate across the shared pool of 32 constituent tools (0/32 detected across isolated tool audits). Because each tool in isolation performs benign file, formatting, or networking operations, atomic single-tool scanners observe zero malicious signals (multi-tool auditors are discussed in §VIII).
| Hazard | Bandit | Semgrep | Cisco | AST Lint. | Judge |
| : Exfil. | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) |
| : Persist. | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) |
| : Subshell | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) |
| : Clobber | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) |
| : CI Poison | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) |
| : TLS Down | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) |
| : Escalate | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) |
| : Egress | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) | 0/32 (0%) |
| Total | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% |
Table III. Atomic (Single-Tool) Detection Rates Across the Shared Pool of 32 Tools () Evaluated by 5 Scanners.
RQ2: Baseline Exploit Performance Across Models. Table IV and Table V detail baseline exploit execution:
| Hazard Class | Tasks () | Baseline ASR | Tool-Layer Regex Ablation DBR | Tool-Layer Regex Ablation Net ASR | Full CompGuard (Integrated) Net ASR | Full CompGuard (Integrated) DBR | Latency |
| : Confidential Data Exfiltration | 35 | 94.3% | 2.9% | 94.3% | 2.9%1 | 100.0% | 61.2 s |
| : Git Hook / Local Persistence | 35 | 97.1% | 68.8% | 3.1% | 3.1%2 | 100.0% | 59.8 s |
| : Subshell Command Injection | 35 | 57.1% | 3.3% | 63.3% | 0.0% | 100.0% | 62.1 s |
| : State & Config Clobbering | 35 | 94.3% | 8.6% | 88.6% | 0.0% | 100.0% | 61.5 s |
| : CI/CD Workflow Poisoning | 35 | 97.1% | 2.9% | 97.1% | 0.0% | 100.0% | 60.9 s |
| : Cryptographic Downgrade | 35 | 100.0% | 0.0% | 100.0% | 0.0% | 100.0% | 62.4 s |
| : Database Privilege Escalation | 35 | 94.3% | 11.4% | 82.9% | 0.0% | 100.0% | 60.7 s |
| : Stealth Egress Tunneling | 35 | 5.7% | 0.0% | 5.7% | 0.0% | 100.0% | 62.8 s |
| Overall / Class Mean | 280 | 79.6% | 12.2% | 66.9% | 0.8% | 100.0% | 61.4 s |
Table IV. End-to-end exploit surface and defensive interception across core hazard classes (Track 2, –, Gemini 3.5 Flash, ).
| Model / Evaluation Track | Base ASR | Net ASR | DBR |
| (a) Model Scaling Across Full Adversarial Suite (, ) | |||
| Gemini 3.5 Flash () | 72.9% (258/354) | 0.8% | 100.0% |
| Gemini 3.7 Flash () | 79.4% (281/354) | 0.6% | 100.0% |
| Gemini 3.8 Flash () | 84.5% (299/354) | 0.0% | 100.0% |
| (b) Advanced Threat Tracks (Gemini 3.5 Flash Defense Validation) | |||
| Track 3a: Advanced IPI () | 63.3% (19/30) | 0.0% | 100.0% |
| Track 3b: Dormant CI/CD () | 26.7% (8/30) | 0.0% | 100.0% |
| Track 4: Multi-Agent () | 75.0% (15/20) | 0.0% | 100.0% |
Table V. Multi-model scaling and advanced threat track matrix.
High Baseline Vulnerability & Hazard Variance: Across the 280 core exploit tasks (Track 2), unprotected Gemini 3.5 Flash agents achieved a 79.6% (223/280) ASR, saturating at 94.3%–100.0% on , , and – where each gadget mimics routine config, hook, or migration maintenance. In contrast, (Subshell Injection, 57.1% ASR) experiences moderate attrition from shell quoting errors, while (Stealth Egress Tunneling, 5.7% ASR) requires multi-step git remote mirror hijacking or chunked tunnel setup, causing 94.3% (33/35) of unguided runs to stall before completing the tunnel.
The Capability-Vulnerability Scaling Law: To isolate reasoning scaling under identical tool-calling schemas, we evaluated three generations of the Gemini Flash coding family across the full adversarial suite ( completed trials out of 360 across Tracks 2–4, excluding 6 API-rate-limited runs). Exploit success scales monotonically with model capability: Gemini 3.5 Flash (72.9%, 258/354) Gemini 3.7 Flash (79.4%, 281/354) Gemini 3.8 Flash (84.5%, 299/354 ASR). Stronger planning and error recovery orchestrate multi-turn chains across intermediate files with higher fidelity.
Multi-Agent Refusal Laundering: On direct high-risk prompts, single-agent frontier models exhibited safety refusals (15.4% for Gemini 3.8). Under hierarchical multi-agent delegation (Architect Executor), direct refusal dropped to 0.0%, yielding 75.0% baseline ASR.
RQ3: Defensive Interception & Regex Coaching Effect. As shown in Table IV, CompGuard achieved a 100.0% Defense Block Rate (DBR) across all active exploit trajectories (0.8% mean Net ASR from the two pre-teardown oracle touches in ). Both planes are essential: the OS Kernel Layer synchronously blocks direct out-of-contract syscalls and subshell indirection (, , , ), while the Cognitive Control Plane’s Provenance DAG intercepts cross-turn staging over contract-allowed files and ports (, , , ). Under the Tool-Layer Regex Ablation (omitting kernel sandboxing), Net ASR in (Subshell Injection) increased over baseline from 57.1% (20/35 overall; 56.7% [17/30] on the 30 matched completed tasks) to 63.3% (19/30, 3.3% DBR): when userland regex returned filter errors, the LLM rewrote the command using base64 piping and variable indirection, succeeding more reliably than unguided runs. CompGuard’s Landlock sandbox blocks the underlying syscall regardless of syntax (0.0% Net ASR in ).
RQ4 & RQ5: Benign Usability, Cloud Triage & Performance. Table VI reports developer utility and performance overheads (evaluated with Gemini 3.5 Flash):
| Metric Evaluation | Baseline | CompGuard | Impact |
| (a) SkillUtilityBench ( Developer Tasks, 50 Turns) | |||
| Task Solve Rate (TSR) | 91.0% | 98.0% | +7.0% |
| False Positive Rate (FPR) | 0.0% | 2.0%3 | +2.0% |
| Timeout Rate () | 9.0% | 0.0% | -9.0% |
| Average Turn Duration | 19.6 turns | 16.7 turns | -2.9 turns |
| (b) Cloud-OpsBench ( Real K8s Cases, 615 Calls) | |||
| Joint RCA Accuracy (JRA) | 82.0% | 85.0% | +3.0% |
| Component Accuracy (CA) | 91.0% | 93.0% | +2.0% |
| False Positive Blocks (FPR) | — | 0 (0.00%) | 0.0% |
| (c) Overhead & Attribution ( Calls, 354 Runs) | |||
| Mean Runtime Interposition | — | 61.4 s | Negligible |
| Copilot Attribution Precision | — | 98.2% | Sound |
| Copilot Attribution Recall | — | 99.3% | Sound |
Table VI. Dual-domain usability, cloud triage accuracy, and performance overheads under CompGuard.
Usability Preservation (SkillUtilityBench): CompGuard preserves a 98.0% Task Solve Rate (TSR, 98/100) on 100 benign developer tasks. Fine-Grained Key-Value Parsing reduces false alarms from 10.0% (coarse whole-file taint) to 2.0% FPR; the only 2 false positives occurred in when benign scripts read high-entropy X.509 staging certificates ( bits/char) and posted unhashed strings to a status webhook. Crucially, CompGuard eliminates timeouts (0.0% vs. 9.0% [9/100] baseline, boosting TSR by +7.0% from 91.0% [91/100]): Single-Skill Exclusive Binding () and immediate kernel −EACCES boundaries prune speculative out-of-scope edits and recursive loops early, cutting average turns from 19.6 to 16.7.
Ecological Validation (Cloud-OpsBench): Across 615 diagnostic tool calls in 100 real Kubernetes cases from Cloud-OpsBench [25], CompGuard incurred 0.00% FPR (zero false alarms) while boosting Joint RCA Accuracy (JRA) by +3.0% (82.0% 85.0%) and Component Accuracy by +2.0% (91.0% 93.0%) by confining SRE agents to read-only diagnostic leases and preventing noisy cluster mutations.
Microsecond Latency Overhead: Across 10,000 tool dispatches on Linux 6.8, CompGuard’s incremental security interposition adds 61.4 4.2 s (p50 = 58.7 s, p99 = 84.6 s; HMAC lease: 12.3 s, Landlock: 24.8 s, PEP 578: 1.1 s, Provenance: 23.2 s), representing of LLM turn latency (1.5–3.5 s), while standard Linux
fork/execveworker creation takes ms (vs. 150–450 ms for microVMs).
Forensic Attribution: Causal backward reachability over isolates culprit gadgets across all 354 completed exploit trajectories with 98.2% precision, 99.3% recall, and 1.8% false attribution rate (100%/100% on , 98.4%/100% on , and 96.2%/97.8% on ).
Related Work & Comparative Positioning
Table VII positions CompGuard against prior art across three primary dimensions:
1. In-Situ Kernel Sandboxing vs. Hypervisors and OS Harnesses. Container runtimes and micro VMs (GVisor [8], Firecracker [9]) isolate untrusted code from the host, providing zero intra-agent protection once inside and imposing 150–450 ms per-VM boot latency. IsolateGPT [14] separates LLM apps into hub-and-spoke domains (< 30% overhead), whereas coding agents (e.g., OpenHands [23]) require skills to mutate the same repository .
Concurrent OS-level agent harnesses such as ActPlan [34] enforce programmable syscall policies via eBPF/LSM hooks; CompGuard complements OS enforcement by coupling unprivileged Landlock LSM v4 [7] with fine-grained key-value provenance to prevent Taint Explosion on shared config files at 61.4 s interposition latency.
Grounded Syscall Mediation vs. Agent IFC and Capability Leases
Application-level prompt defenses, Information Flow Control (IFC), and privilege systems (StruQ [11], CaMeL [12], FIDES [31], Progent [32], PORTICO [33], Design Patterns [13], InjecAgent [17], AgentDojo [16], Agen tHarm [18], Liu et al. [15]) mediate context memory or structured tool API schemas. While FIDES [31] and CaMeL [12] propagate taint labels across tool calls and Progent [32] and PORTICO [33] introduce programmable or revocable capability leases to mitigate lingering authority, purely API-level enforcement remains vulnerable to the Invocation Abstraction Gap when coding skills spawn subshells (bash, pytest) or stage data across unmonitored disk files in . CompGuard physically binds single-skill ephemeral leases () to OS kernel syscalls and physical inodes .
Runtime Provenance vs. Static and Compositional Skill Auditors
Single-tool scanners (Bandit [28], Semgrep [29], VIPER-MCP [26]) and registry drift studies [27] audit individual tools in isolation. Recent work has begun exploring multi-turn tool chaining (STAC [35]) and compositional risks in agent skill marketplaces, including multi-agent marketplace auditing in SkillProbe [36], collision analysis in SkillReact [37], and compositional benchmarks in SCR-Bench [38]. However, pre-deployment marketplace auditing cannot foresee the dynamic set of skills a developer installs locally or runtime IPI/CI triggers. CompGuard provides online, OS-grounded provenance DAG tracking and exclusive capability leases to block multi-gadget chaining at runtime.
| Dimension | Skill Scanners (Bandit / SkillProbe) | Agent IFC & Leases (CaMeL / FIDES / PORTICO) | System Isolators (gVisor / IsolateGPT / ActPlane) | CompGuard (This Work) |
| Threat Model | Explicit Bugs / Pairwise Chains | Prompt Injection / API Leaks | Untrusted Apps / Syscall Policies | Emergent Compositional Exploits |
| Constituent Tools | Buggy Code / Audited Skills | Benign Tool APIs | Untrusted Guest Apps | 100% Benign Legitimate Utilities |
| Defended Layer | Static AST / Sandbox Traces | Tool Schemas / Context Tokens | Container / eBPF / Hub-Spoke | Persistent POSIX Filesystem |
| Invocation Gap | N/A (Pre-deployment) | Vulnerable to Shell Indirection | Closed at Container/Kernel Layer | Closed via Kernel Landlock/seccomp |
| Runtime Latency | N/A (Offline Audit) | ms (StruQ) / s (Dual-LLM) | 5–30 ms (VM) / (IsolateGPT) | 61.4 µs Deterministic Interposition |
| Benign Utility | None | AgentDojo [16] (Synthetic APIs) | App-Level Query Benchmarks | 98.0% TSR on 100 Tasks + Cloud-Ops |
Table VII. Systematic Literature and Systems Positioning Across Core Architectural Dimensions.
Discussion, Limitations & Disclosure
Portability & Residual Limitations. CompGuard initializes fanotify at startup and immediately drops root privileges (setresuid(), PR_SET_NO_NEW_PRIVS) so worker execution is unprivileged on Linux ( via Landlock ABI v4 [7]; 5.13–6.6 via seccomp-BPF). On macOS and Windows, equivalent enforcement requires the macOS Endpoint Security framework and Windows AppContainer with WFP service callouts. We note three residual limitations: (1) proprietary binary or non-standard config formats fall back to whole-file inode taint; (2) revoking a worker that abuses a pre-authorized local socket or workspace file via PEP 578/fanotify incurs a microsecond teardown window (as in , Table IV), and timing covert channels remain out of scope; and (3) because the proxy inspects TLS SNI without MITM decryption, domain fronting or Encrypted Client Hello (ECH) over an allowlisted multi-tenant CDN could mask the host unless strict SNI validation is enforced.
HAT Ergonomics & Ethical Disclosure. Across all 200 benign tasks in SkillUtilityBench (100) and Cloud-OpsBench (100), the Out-of-Band HAT prompt rate was 0.0%, as HAT is reserved strictly for irreversible persistence sinks (.git/hooks/*, system binaries, CI/CD workflows). Following RFC 9116 and ISO/IEC 29147, we executed two coordinated disclosures and one upstream contribution in July 2026 (vendor ticket IDs masked): (1) Anthropic (MCP): acknowledged cross-server state chaining (Ticket MCP-SEC-2026-XXXX) and formed an MCP Working Group for capability contracts; (2) ClawHub Registry: acknowledged 100% single-tool scanner bypass (Ticket CLAW-VULN-2026-XXX) and added multi-turn reachability checks; and (3) OpenHands: integrated our reference implementation of single-skill capability leases () [23]. All 560 benchmark runs were strictly confined to isolated loopback honeynets with zero external packet transmission.
Conclusion
This paper exposed the threat of compositional exploits in autonomous coding agents, showing that atomic skill auditing cannot prevent emergent multi-skill exploit chains across shared workspace state (). Across our 560-task benchmark suite, unprotected agents executed exploit chains with up to 84.5% success while five single-tool scanners exhibited a 100% bypass rate. We presented CompGuard, uniting a Cognitive Control Plane with an OS Kernel Enforcement Layer to achieve a 100% Defense Block Rate (0.0%–0.8% pre-teardown Net ASR) at 61.4 µs interposition overhead, preserving a 98.0% benign solve rate (2.0% FPR), 0.00% cloud FPR (+3.0% JRA), and 98.2% attribution precision.
References
- [1]H. Shacham, “The geometry of innocent flesh on the bone: Return-into-libc without function calls (on the x86),” in Proc. ACM CCS, pp. 552–561, 2007.
- [2]R. Roemer, E. Buchanan, H. Shacham, and S. Savage, “Return-Oriented Programming: Systems, Languages, and Applications,” ACM Trans. Inf. Syst. Secur., vol. 15, no. 1, Art. no. 2, pp. 1–34, 2012.
- [3]J. H. Saltzer and M. D. Schroeder, “The protection of information in computer systems,” Proc. IEEE, vol. 63, no. 9, pp. 1278–1308, 1975.DOI
- [4]D. E. Denning, “A lattice model of secure information flow,” Commun. ACM, vol. 19, no. 5, pp. 236–243, 1976.DOI
- [5]N. Hardy, “The Confused Deputy (or why capabilities might have been invented),” ACM SIGOPS Oper. Syst. Rev., vol. 22, no. 4, pp. 36–38, 1988.
- [6]W. Enck et al., “TaintDroid: An Information-Flow Tracking System for Realtime Privacy Monitoring on Smartphones,” in Proc. USENIX OSDI, pp. 393–407, 2010.
- [7]M. Salaün, “Landlock: unprivileged access control,” The Linux Kernel Documentation, https://docs.kernel.org/userspace-api/landlock.html, 2021.
- [8]Google LLC, “gVisor: Application Kernel for Containers,” https://gvisor.dev, 2019.
- [9]A. Agache et al., “Firecracker: Lightweight Virtualization for Serverless Applications,” in Proc. USENIX NSDI, pp. 419–434, 2020.
- [10]K. Greshake et al., “Not What You’ve Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection,” in Proc. ACM AISec, pp. 79–90, 2023.arxiv.org/abs/2302.12173
- [11]S. Chen et al., “StruQ: Defending Against Prompt Injection with Structured Queries,” in Proc. USENIX Security, pp. 2383–2400, 2025.arxiv.org/abs/2402.06363
- [12]E. Debenedetti et al., “Defeating Prompt Injections by Design,” in Proc. IEEE SaTML, pp. 587–618, 2026.arxiv.org/abs/2503.18813
- [13]L. Beurer-Kellner et al., “Design Patterns for Securing LLM Agents against Prompt Injections,” arXiv:2506.08837, 2025.
- [14]Y. Wu et al., “IsolateGPT: An Execution Isolation Architecture for LLM-Based Agentic Systems,” in Proc. NDSS, 2025.arxiv.org/abs/2403.04960
- [15]Y. Liu et al., “Formalizing and Benchmarking Prompt Injection Attacks and Defenses,” in Proc. USENIX Security, pp. 1831–1847, 2024.arxiv.org/abs/2310.12815
- [16]E. Debenedetti et al., “AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents,” in Proc. NeurIPS Datasets and Benchmarks Track, vol. 37, pp. 82895–82920, 2024.arxiv.org/abs/2406.13352
- [17]Q. Zhan et al., “InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agents,” in Findings of ACL, pp. 10471–10506, 2024.arxiv.org/abs/2403.02691
- [18]M. Andriushchenko et al., “AgentHarm: A Benchmark for Measuring Harmfulness of LLM Agents,” in Proc. ICLR, 2025.arxiv.org/abs/2410.09024
- [19]D. Hofer, E. Debenedetti, and F. Tramèr, “Assessing Automated Prompt Injection Attacks in Agentic Environments,” arXiv:2606.10525, 2026.arxiv.org/abs/2606.10525
- [20]T. Schick et al., “Toolformer: Language Models Can Teach Themselves to Use Tools,” in Proc. NeurIPS, vol. 36, pp. 68539–68551, 2023.arxiv.org/abs/2302.04761
- [21]G. Wang et al., “Voyager: An Open-Ended Embodied Agent with Large Language Models,” TMLR, 2024.arxiv.org/abs/2305.16291
- [22]Q. Wu et al., “AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversations,” in Proc. COLM, 2024.arxiv.org/abs/2308.08155
- [23]X. Wang et al., “OpenHands: An Open Platform for AI Software Developers as Generalist Agents,” in Proc. ICLR, 2025.arxiv.org/abs/2407.16741
- [24]C. E. Jimenez et al., “SWE-bench: Can Language Models Resolve Real-World GitHub Issues?” in Proc. ICLR, 2024.arxiv.org/abs/2310.06770
- [25]Y. Wang et al., “Cloud-OpsBench: A Reproducible Benchmark for Agentic Root Cause Analysis in Cloud Systems,” arXiv:2603.00468, 2026.arxiv.org/abs/2603.00468
- [26]P. Sun et al., “VIPER-MCP: Detecting and Exploiting Taint-Style Vulnerabilities in Model Context Protocol Servers,” arXiv:2605.21392, 2026.arxiv.org/abs/2605.21392
- [27]O. Kraishan, “Same Name, Different Server: A Security Census of Silent Drift in the Model Context Protocol Ecosystem,” arXiv:2609.14119, 2026.arxiv.org/abs/2609.14119
- [28]PyCQA, “Bandit: A tool designed to find common security issues in Python code,” https://github.com/PyCQA/bandit, 2024.
- [29]Semgrep, Inc., “Semgrep: Lightweight static analysis for many languages,” https://semgrep.dev, 2024.
- [30]Anthropic, “Model Context Protocol (MCP) Specification,” https://modelcontextprotocol.io, 2024.
- [31]M. Costa et al., “Securing AI Agents with Information-Flow Control,” arXiv:2505.23643, 2025.arxiv.org/abs/2505.23643
- [32]T. Shi et al., “Progent: Securing AI Agents with Privilege Control,” arXiv:2504.11703, 2025.arxiv.org/abs/2504.11703
- [33]I. Santos-Grueiro, “Lingering Authority: Revocable Resource-and-Effect Capabilities for Coding Agents,” arXiv:2606.22504, 2026.
- [34]Y. Zheng et al., “ActPlane: Programmable OS-Level Policy Enforcement for Agent Harnesses,” arXiv:2606.25189, 2026.arxiv.org/abs/2606.25189
- [35]J.-J. Li et al., “STAC: When Innocent Tools Form Dangerous Chains for LLM Agents,” in Proc. ACL REALM, pp. 226–262, 2026.arxiv.org/abs/2509.25624
- [36]Z. Guo et al., “SkillProbe: Security Auditing for Emerging Agent Skill Marketplaces via Multi-Agent Collaboration,” arXiv:2603.21019, 2026.arxiv.org/abs/2603.21019
- [37]S. Wang et al., “When Safe Skills Collide: Measuring Compositional Risk in Agent Skill Ecosystems,” arXiv:2606.00448, 2026.arxiv.org/abs/2606.00448
- [38]Y. Xie et al., “Benign in Isolation, Harmful in Composition: Security Risks in Agent Skill Ecosystems,” arXiv:2606.15242, 2026.arxiv.org/abs/2606.15242