Coding agent security belongs outside the model
Reviewing From Attack Surface to Defense Architecture: Compositional Security for Agentic Coding Harnesses · Simon Hegelich, Bardh Prenkaj, Habiba Sarhan et al.

Researchers show that a deterministic monitor sitting between a coding agent and the operating system can block injected attack chains that a second LLM judge only stops by refusing almost everything. The key is tracking where data came from and how sensitive it is across steps, not judging each command alone.
A coding agent reads the instructions file that sits at the top of a software project. Hidden in it is an instruction. The agent then runs curl, find and bash, the same tools it uses all day, and the attacker never has to bring a payload. The researchers call this living off the land, and the label fits.
The usual responses are a blacklist of dangerous strings or a second LLM that judges every command. The study shows why both disappoint. A regex misses commands built to avoid its patterns. A small local judge model did stop the attacks, but only by refusing 98.3% of benign engineering work. It also added well over a tenth of a second to every action.
The proposed design, ActiveSecHarness, rests on one idea: the model reasons, but something else holds the authority. The model proposes tool calls. A deterministic monitor at the OS boundary decides whether they run. Permissions travel as signed tokens that can be narrowed as they pass down through layers of trust, never widened.
Single steps are the wrong unit
What interests me most is the multi-step work. In a kill chain, every step looks harmless on its own. Read a config file, write a note, later send that note to an endpoint the agent is allowed to reach. A policy that judges one action at a time, even an idealised one, missed 4 of 12 such chains.
The obvious fix is to mark the whole session tainted once untrusted content arrives. That blocked most benign workflows, so nobody would leave it switched on. Instead, the researchers track two things separately: how far the source of some data can be trusted, and how sensitive the data is. A ledger follows files on disk. A secret written out and read back keeps its label, so laundering it through the filesystem stops working. That combination caught every chain with no false positives, at a few microseconds per step.
None of this is a new idea. It is information flow control, decades old, applied to a new target. It is the right instinct, because the attack is about composition and the defence now is too.
The limits matter. The perfect scores come from the researchers' own benchmark of 252 test cases. The guarantees cover structured tool calls and the attack types they wrote, not arbitrary code the model generates. The evaluation does not describe an attacker who knows the monitor is there and probes its labelling. The judge was a deliberately small model, so a stronger one would score better, although the latency cost would remain. Flaws in an application's own business logic still depend on model review.
Even so, the direction holds. The attack never lived in the model. The defence should not either.
Further analysis
Problem
This paper studies security for agentic coding harnesses that couple language models to shells, filesystems and network sockets. Such harnesses effectively become automated Living‑off‑the‑Land platforms: if adversaries can inject instructions into retrieved content, dual‑use binaries like bash, curl and find serve as the payloads. The authors argue that safety is a structural property of the cognitive architecture and of permission composition across agents and humans, not an emergent property of any individual model; common industry responses such as regex blacklists or a second LLM acting as a judge are either blind to structural evasions or impose untenable latency and false positives.
Approach
The authors present ActiveSecHarness, a neurosymbolic reference‑monitor architecture built around Separation of Intelligence and Authority. Its core components are: Macaroon‑inspired HMAC capability tokens attenuated across four Trust and Authority Rings; a two‑dimensional product taint lattice that composes provenance integrity and data confidentiality plus a Workspace Provenance Ledger to prevent secret laundering; deterministic Ring‑0 OS and tool guards; and verification tooling including bytecode certificates for registered tools, split‑horizon dual‑key audit logs, a CodeVerifier/DualModelReviewer/SecurityTestSynthesizer repair loop, and a progressive UserWikiManager to educate operators. The design enforces complete mediation, least privilege, resource containment and temporal integrity at the OS boundary. Evaluation uses a benchmark of N=252 fixtures composed of 120 single‑step attacks, 120 benign software‑engineering workflows and 12 five‑stage kill chains, compared across unguarded, regex, live LLM judge (qwen3:4b), Ring‑0 and hybrid regimes, plus a multi‑step trajectory ablation against oracle and coarse taint baselines.
Key Findings
- Deterministic Ring‑0 mediation blocks all evaluated attacks (attack block rate ABR=1.000) while producing zero false positives (FPR=0.000) at a median mediation latency of 12.7 µs, substantially below interactive budgets and about 11,200 times faster than a live local LLM judge.
- A live local LLM judge (qwen3:4b) can also block the benchmark attacks but does so only by refusing 98.3% of benign engineering work, with a median latency of 142.3 ms, demonstrating severe false‑positive and latency trade‑offs for inline probabilistic guards.
- In multi‑step trajectory tests the idealised stateless oracle Conseca‑style policy misses 4 of 12 kill chains (ABR=0.667), while a coarse Boolean taint lock blocks 83.3% of benign workflows (FPR=0.833). The proposed 2D product lattice plus Workspace Provenance Ledger achieves ABR=1.000 and FPR=0.000 at roughly 20 µs per step, folding provenance in constant time per step.
- Concrete OS‑level guards such as ArchiveGuard, MalwareGuard, CredentialGuard, NetworkGuard, SandboxGuard and cryptographic canaries are necessary to defeat classical primitives (symlink races, path traversal, SSRF, ZipBombs, Trojan Source, credential leakage) that agentic tool chaining accelerates.
Limitations
Results are reported on a structured benchmark of 252 fixtures and controlled multi‑step trajectories; Ring‑0 guarantees are shown for deterministic checks over the provided fixture types and structured tool‑call objects rather than for arbitrary open‑ended code generation. The authors explicitly note they do not claim end‑to‑end task completion or absence of semantic bugs for weak planner or coder models; detection of novel application‑specific business logic vulnerabilities depends on the capabilities of Ring‑22 review and test synthesis. The live judge evaluation uses a compact local model as a representative small‑model worst case; different models or richer prompts would alter single‑action utility but not the architectural trade‑offs described.
Implications
Offensive implications emphasise that, absent architectural enforcement, attackers can weaponise indirect prompt injection and dual‑use binaries to execute arbitrary commands, pivot to internal services, trojan tools, persist via build hooks, launder secrets across collaborating agents, and exfiltrate via allowed network endpoints. The paper shows these vectors are best exploited by manipulating provenance and composition rather than by simple token patterns, so attackers benefit when harnesses rely on string filters or probabilistic judges. Conversely, the ActiveSecHarness design raises the bar for such attacks by moving policy into cryptographically bound capability tokens, OS‑level guards and provenance folding, but the evaluation also highlights that defenders need high‑capability review and test synthesis facilities to find application‑specific faults; weakening model capability at the weight level would hinder defenders more than attackers if architectural enforcement is absent.
The paper title, authors and abstract
From Attack Surface to Defense Architecture: Compositional Security for Agentic Coding Harnesses
AI coding harnesses couple language models to shells, filesystems, and network sockets, turning the harness into an automated Living-off-the-Land (LotL) platform: once an adversary injects instructions into retrieved content, dual-use binaries such as bash, curl, and find become the payload. We argue that security in agentic systems is a structural property of the cognitive architecture and permission composition rather than an emergent property of individual models. Static regex blacklists miss structural evasions, whereas LLM-as-a-Judge guardrails incur high latency while over-blocking benign work. We present ActiveSecHarness, a neurosymbolic reference-monitor architecture built around Separation of Intelligence and Authority. It combines (1) Macaroon-inspired HMAC capability tokens across four Trust and Authority Rings, (2) a 2D product taint lattice $\mathcal{L} = \mathcal{L}_{\mathrm{trust}} \times \mathcal{L}_{\mathrm{sens}}$ and a workspace provenance ledger that prevents secret laundering across disk, (3) deterministic Ring-0 OS/tool guards, and (4) bytecode certificates, split-horizon audit logs, self-healing security test synthesis, and an adaptive UserWikiManager. Across $N=252$ fixtures ($120$ attack, $120$ benign, $12$ kill chains), a live local LLM judge (qwen3:4b) refuses $98.3\%$ of benign work at $142.3\,\mathrm{ms}$ latency, whereas Ring 0 achieves $\mathrm{ABR}=1.000$ and $\mathrm{FPR}=0.000$ in $12.7\,\mu\mathrm{s}$ ($11{,}200\times$ faster). In a multi-step trajectory ablation, an oracle Conseca-style stateless policy misses $4/12$ kill chains ($\mathrm{ABR}=0.667$) and coarse Boolean taint blocks $83.3\%$ of benign workflows, while our 2D product lattice achieves $\mathrm{ABR}=1.000$ and $\mathrm{FPR}=0.000$ at $\approx 20\,\mu\mathrm{s}$ per step.


