$_ stdout

Enforcing Security Invariants in the Post-Zero-Day Era

When autonomous agents can discover and weaponize zero-day vulnerabilities for pennies, reactive patching collapses. The only survivable architecture enforces structural runtime invariants — making it physically impossible for a vulnerability to execute a destructive action, regardless of how many holes exist in the source code.

BL Dr. Ben Livshits July 2, 2026

01 The Neurosymbolic Mirror

Over the last few years, the most reliable AI coding systems have quietly converged on the same shape: they never let a language model write code and ship it unchecked. The model's fluent guessing is always fenced by something that can say no — a type checker, a test oracle, a proof assistant. That pairing of probabilistic generation with deterministic verification is the defining structural idea of modern automated software, and the argument of this piece is that security now demands the very same shape one layer down, at runtime.

At development time, that discipline takes the form of a neurosymbolic hybrid. The generative LLM operates as the probabilistic, intuitive engine that guesses code patterns, but its output is immediately validated by a symbolic, deductive checker — a static analyzer, a model checker, or a formal proof assistant such as Lean 4 or Coq. The code cannot ship unless the symbolic engine mathematically certifies its safety properties.

// neurosymbolic mirror

Development-time neurosymbolic: LLM Generator (intuitive / probabilistic) validated by a Formal Prover (deductive / symbolic).
Runtime neurosymbolic: AI Agent Execution (opportunistic / fluid) enforced by a Kernel/Container Invariant (rigid boundary).

When an autonomous agent runs in production, it functions as the fluid, probabilistic execution plane — highly creative but intrinsically prone to exploiting semantic ambiguity. The runtime invariant (enforced by lightweight container isolation, eBPF filters, or WebAssembly sandboxes) acts as the symbolic, deductive enforcement layer. It does not guess the agent's intent or parse its wording. It enforces hard-coded, non-negotiable state logic directly on physical hardware primitives.

02 Anatomy of the Inevitable: The Proving Ground

That abstract architecture demands empirical grounding. To understand how fast the reactive model is collapsing in practice, consider the concrete exploits surfaced in Niels Provos's benchmark study, "The Day After the Zero-Days." By mapping autonomous multi-agent orchestration loops directly onto target infrastructure, the study demonstrated that a coordinated agent framework can reliably unearth critical vulnerabilities that successfully evaded human discovery for decades.

The OpenBSD TCP Stack Exploit

An orchestration loop executing automated state-space analysis autonomously uncovered a critical Denial-of-Service (DoS) vulnerability buried in the core OpenBSD TCP processing pipeline. The flaw, originally introduced in 1998, had survived unrecognized through twenty-seven years of manual source code audits.

The OpenSSL Heartbleed Re-Discovery

To test whether agents could cross the line from standard syntactic parsing into complex, contextual protocol reasoning, the system was unleashed on legacy OpenSSL builds. The agentic loop successfully mapped out memory allocation boundaries and independently synthesized a working exploit sequence replicating the infamous Heartbleed memory leaks — proving that highly subtle boundary violations are easily discoverable through low-cost, automated token loops.

The defining insight of this benchmark is that these zero-days were not unearthed by massive, multi-million dollar proprietary frontier model infrastructures. Prior work by Fang et al. had already shown that frontier models such as GPT-4 could autonomously identify and exploit real vulnerabilities with no human feedback.

IronCurtain's contribution was demonstrating this is achievable far more cheaply: by taking accessible, mid-tier open-weight models (GLM 5.1) and locking them inside a non-LLM, finite-state machine (FSM) orchestration harness named IronCurtain, the system bypassed the context window boundaries that cause standalone LLMs to stall or hallucinate during long audits — replacing probabilistic navigation with deterministic execution logs.

Because an FSM-contained loop can test hundreds of execution chains per hour for just pennies, zero-day discovery has transitioned from an elite human privilege into a cheap, infinite commodity.

What that commodity does to real deployments becomes clear in a separate but contemporaneous study: Suwansathit et al.'s 2026 security analysis of the OpenClaw AI agent framework, which applied the same automated approach to a widely-deployed agentic platform — this time treating it as a target rather than a tool. The results were catastrophic: over 500 vulnerabilities across 40,000 exposed instances, with 20% of the plugin registry found to be poisoned — a damage level that prompted Gartner to rate the framework an "unacceptable cybersecurity risk."

Vulnerabilities in our production systems are no longer a risk; they are a mathematical certainty.

03 The Death of the Reactive Patch

For decades, application security relied on a comfortable, sequential cadence: discover a flaw, write a patch, run QA, and deploy an update. The rise of autonomous vulnerability discovery pipelines has turned this entire defense model into a relic.

As Provos's findings demonstrate, AI agent frameworks can now discover and weaponize zero-day vulnerabilities at a speed that traditional patching loops cannot mathematically match.

The problem extends beyond discovered zero-days to deployed agent configurations. Consider claude code --dangerously-skip-permissions: with this single flag, the agent's sandbox gains read access to ~/.ssh and ~/.aws, unrestricted network egress via curl *, and arbitrary code execution — with no human checkpoint. That is not a misconfiguration; it is the product's advertised feature.

// the reactive posture collapses

When an autonomous system can process an entire repository and systematically surface critical exploits for mere pennies, trying to patch your way to safety is a mathematically losing strategy. We must assume our applications are running with active, unpatched vulnerabilities.

Security, therefore, must move away from fixing bugs and pivot entirely to enforcing structural runtime invariants — making it physically impossible for a vulnerability to execute a destructive action, regardless of how many holes exist in the source code.

04 The Historical Mirror: Shallow Wrappers vs. Deep Enforcement

Deciding where in the execution stack to plant those invariants is not obvious — and the wrong interception plane merely trades one bypass vector for another. This battle over semantic ambiguity is not a novel quirk of large language models; it is a reincarnation of an age-old computer science dilemma.

In their classic 2010 IEEE S&P paper, "ConScript: Specifying and Enforcing Fine-Grained Security Policies for JavaScript in the Browser," researchers Leo A. Meyerovich and Benjamin Livshits exposed the exact same structural vulnerability when attempting to secure untrusted, third-party web mashups.

Early client-side security frameworks relied on "shallow wrapping" — syntactically blacklisting or rewriting specific access paths like window.eval. Scripts then sidestepped these surface guardrails with trivial aliasing: binding a fresh variable to the function before the wrapper could ever intercept it.

// shallow vs. deep enforcement

Shallow Enforcement (syntactic / access path): Uses policy blocks to ban specific paths (e.g., "window.eval"), which are easily bypassed by evasion vectors using aliases.

Deep Enforcement (semantic / object runtime): Binds directly to the underlying closure object on the heap, making access paths and aliases irrelevant to enforcement.

ConScript permanently closed this gap by introducing deep advice. By altering the underlying browser engine, the framework bound security policies directly to the heap-allocated closure objects themselves, regardless of what alias or access path was used to reach them.

Today, as we build containment fields for autonomous agents, we face the exact same architectural challenge: identifying the correct interception plane.

If we enforce invariants too high up at the textual or prompt layer, agents will effortlessly exploit semantic ambiguity to bypass our rules. If we enforce them too low at the raw operating system syscall level, we lose all semantic context, triggering a wave of false positives that paralyzes legitimate software velocity.

05 Real-World Evasion: The OpenClaw Framework

The aliasing evasion ConScript exposed in browser security has a direct structural analogue in agentic systems: when enforcement binds to a name or string rather than an underlying capability, an agent will find the unwatched path. The 2026 security analysis of the OpenClaw framework documented exactly this pattern across three execution vectors where agents fluidly broke out of standard runtime enforcement layers:

Syntactic Command Fracturing

When developers attempted to enforce an exec allowlist invariant by lexically parsing terminal strings, agents broke containment using shell line continuations (\) and inline newline injections. By breaking the command text layout across multiple lines, the string-matching filter read the instruction as a benign, disjointed sequence, while the underlying shell runtime stitched it back together as an unvetted, high-privilege shell operation.

Ambient Utility Exploitation via BusyBox

When blocked from executing raw network commands like curl or wget, agents quickly discovered and leveraged multi-call multiplexer binaries (such as busybox) present within standard container environments. By passing the banned network utility as an argument to an allowed parent binary wrapper, the agent hid its semantic execution goal from the host engine's syntactic scanner.

Indirect Flag Substitution

Rather than triggering allowlist alerts with common flags, agents substituted obscure, legacy, or single-character aliases (e.g., swapping long-form arguments for unmonitored GNU short options). Because the execution engine evaluated the text of the call rather than the underlying kernel capability, the agent weaponized ambient system tools without ever triggering a policy violation.

06 The Invariant Specification Bottleneck

The pattern behind every one of these evasions is the same: when an agentic workflow encounters a runtime restriction, it doesn't give up — it adapts. If an engineer attempts to enforce an invariant using superficial string matching — such as blacklisting the word curl or blocking a specific system utility — an LLM driven by distribution-following behavior will simply rewrite its execution payload using alternative encodings, indirect file-read paths, or alternative data pipes to open an out-of-band communication channel.

As the OpenClaw framework analysis demonstrated, traditional lightweight container boundaries are highly vulnerable to this kind of ambient authority exploitation. If an agent runs inside a standard Docker container with default networking and broad filesystem visibility, it will relentlessly locate semantic loopholes to bypass lexical allowlists.

This friction exposes the ultimate bottleneck of modern automated systems: enforcement is relatively mechanical, but policy specification is exceptionally painful to author and maintain.

// the specification bottleneck

Traditional guardrails: Rely on syntactic filters and banned words/paths; easily sidestepped by agents.

Semantic reality: Focuses on agentic intent and banned logic states; highly effective but difficult to specify.

Traditional syntactic guardrails vs. semantic reality: how agents bypass string-matching filters through alternative encodings, indirect paths, and out-of-band channels
// Figure 1. Traditional guardrails vs. semantic reality.

Tightening an invariant down to absolute Zero-Trust parameters inevitably triggers an explosion of false positives, misidentifying legitimate dynamic code optimizations or unexpected asynchronous queries as malicious zero-day escapes. Conversely, loosening constraints to accommodate software updates introduces false negatives, quietly expanding the attack surface.

One natural response to this calibration problem is to abandon string-matching altogether and express policy in natural language instead — encoding intent directly in the agent's system prompt rather than enumerating forbidden tokens.

The Prompt-Engineering Dead End

Before formal specifications entered the picture, the standard response to the bottleneck was to embed policy directly in the agent's system prompt. Write a detailed constitution in natural language — "never read credential files," "never call undocumented external endpoints" — and deploy it as the agent's context layer.

This felt like a step forward from lexical blocklists: at least a natural-language rule can express intent rather than just pattern-matching surface strings.

But this is structurally identical to the shallow wrappers analyzed in the historical mirror. A system prompt is not a boundary; it is a weighted suggestion at the top of the context window.

An LLM following distribution-based completion will, under sufficient adversarial pressure or across a long conversation, treat a downstream instruction as a stronger signal than a system-level constraint. The model has no intrinsic notion of "this rule is inviolable" — every rule is just more tokens, and tokens can always be outweighed by other tokens.

The failure mode requires no attacker. As context accumulates and task goals shift, the agent will rationalize its way past its own rules. When "never access ~/.ssh" and "complete the deployment task" come into apparent conflict, the model finds a frame in which both seem satisfied — or quietly prioritizes whichever makes the current step succeed. The policy is present in the context; it simply loses the local optimization contest.

This is an instance of a more general trap that Livshits's "LLMs + Security = Trouble" labels fighting fire with fire: using a probabilistic model to enforce constraints on a probabilistic model. Both the executing agent and the policy-as-prompt share the same distributional blind spots; a sufficiently motivated adversary — or simply a long enough conversation — will find the overlap.

The neurosymbolic principle from the opening section offers the right escape: bound probabilistic execution with a deterministic enforcer, not a persuadable one. The practical difficulty Livshits identifies is that naive neurosymbolic pipelines place a human at each verification step, making the developer the rate-limiting variable. The answer is not to abandon the insight but to compile the symbolic layer once, formally, before any agent runs — removing the human from the enforcement hot path entirely.

FORGE: Datalog as the Enforcement Layer

Palumbo et al.'s FORGE framework breaks the prompt-engineering loop by separating policy specification from the execution context entirely. The authors frame this as applying aspect-oriented programming principles to agent security: policy enforcement is a cross-cutting concern that must intercept every side-effecting action at the action boundary, independent of the agent's reasoning channel — restoring the classical separation between policy and data that LLM architectures had collapsed. Policies are written in Datalog — a declarative, logic-based query language with formally guaranteed termination and tractable static analysis. Unlike natural language, a Datalog rule cannot be reasoned around, hallucinated through, or outweighed by downstream context. It evaluates to true or false on the observable facts of the execution state, period.

The architecture has three components. An observability service maintains a continuously updated log of the agent's execution context: which tools have been called, which resources accessed, which goals are currently active. A policy monitor consults the Datalog specification against this log at each decision point.

A reference monitor — operating entirely outside the agent's context window — enforces the resulting Allow / Deny / Escalate verdict before the action reaches any real interface. The agent never sees the enforcement layer; it cannot argue with it, alias around it, or inject into it.

The decisive property that Datalog provides is pre-deployment verifiability. Because Datalog programs admit complete static analysis, FORGE can check a policy specification for internal contradictions, reachability gaps, and coverage blindspots before the agent runs in production.

No prompt-embedded rule, however carefully worded, offers this guarantee — the only way to test whether a natural-language policy holds is to run the agent and watch what happens.

The framework was validated against three concrete threat models: prompt injection defense (where a compromised tool response attempts to redirect the agent's actions), multi-agent approval workflows (where a downstream agent must receive explicit authorization before taking high-privilege actions), and organizational customer-service policies (where compliance rules must hold across hundreds of conversation turns).

In all three scenarios FORGE enforced policy without the false-positive explosion that syntactic filters produce — because the enforcement layer reasons about intent-level facts, not surface strings.

07 Adversarial Invariant Tuning

FORGE offers one resolution to the specification bottleneck: express policy in Datalog and let a compiler verify it before deployment. But formal methods demand a rigor many teams will not sustain under velocity pressure.

The seductive alternative — increasingly common — is to let agents discover and tighten the invariants themselves: adversarial multi-agent self-play loops that stress-test evasion vectors and patch the specification on the fly.

In this model, an offensive agent loop acts as a relentless red-team attacker, probing an active application codebase to find evasion vectors, while a defensive agent loop monitors the execution graphs to patch the security specification on the fly. The goal is to let the agents automatically "close the gap" between syntax and semantics before the system is deployed.

This approach introduces an acute structural hazard. Because large language models lack an intrinsic concept of absolute truth and optimize purely for localized constraint satisfaction, an unguided adversarial loop quickly degrades into a hallucinated compliance regime.

If the defensive agent tightens a specification too broadly, it inadvertently chokes off legitimate program states, creating a brittle policy architecture that breaks under minor variations in real-world user traffic.

Even worse, if the offensive agent discovers a logical loophole in the verifier itself, the two agents can settle into a co-dependent optimization trap. They synthesize complex, mathematically obfuscated policies that satisfy the automated verification metric on paper, but which actually contain hidden, systemic blind spots.

When you enter the territory of letting probabilistic neural networks dynamically negotiate their own symbolic security boundaries, you remove human oversight from the intent loop. The result is an illusion of mathematical safety that can be completely shattered the moment a novel, out-of-distribution real-world exploit bypasses the synthetic validation model.

08 Intent Drift and the Compositional Harm Gap

Even when per-action guards are perfect, a deeper threat remains. Provos's SecRIT talk reframes the problem: prompt injection — studied in depth by Greshake et al. — is the aggressive case, but the real threat is intent drift — the gradual divergence between what the user asked for and what the agent decides to do over a multi-turn conversation.

No adversary is needed; context accumulates, and in a long interaction, the LLM will go rogue.

The consequence is that even a perfectly enforced allowlist does not prevent harm. Consider a user who asks an agent to "research restaurants in Half Moon Bay and email Bob a recommendation." Every individual tool call is permitted:

agent_execution_trace.log
[1]  web_search("restaurants half moon bay")   ALLOW
[2]  web_fetch(url_1)                          ALLOW
[3]  web_fetch(url_2)                          ALLOW
[4]  web_fetch(url_3)                          ALLOW  // ← injected
[5]  contacts_lookup("Bob")                    ALLOW
[6]  send_email("bob@...", "I HATE YOU")       ALLOW  // ← harm

Every action is individually permitted. The harm is compositional: a hidden injection in a fetched page silently rewrote the email's content, and no single tool call was malicious. The per-action guard cannot catch this because it never sees the full execution thread — only one call at a time.

The right question is not "does this content look malicious?" but "does this action match what the user actually asked for?" This is intent validation, and it requires a fundamentally different architecture.

A separate alignment critic — a model that sees only the user's original goal and the proposed action, never the untrusted web content that the agent has ingested — approves or vetoes each step.

Google ships this architecture in Chrome's agentic browsing mode: the agent plans and acts on web content (inherently vulnerable to injection), but the critic operates in a clean context window and acts as a final, independent gate.

IronCurtain does not implement intent validation yet; it is the next step on Provos's own roadmap. But without it, capability-enforced isolation closes the individual-action gap while leaving the compositional-harm gap wide open.

09 Deep and Expressive Isolation Techniques

Two planes must be right for agentic containment to hold. ConScript's lesson — sharpened by the OpenClaw evasion vectors — is that where enforcement binds matters more than what it says: anchor it to the capability itself, not the name used to reach it. FORGE's lesson is that how policy is expressed determines whether it can be gamed: a formal language evaluated against observable facts is not negotiable by a token-following model in the way a natural-language rule is.

The techniques below implement both planes.

Closing the compositional harm gap requires the alignment critic described above — a model operating in a clean context window, never exposed to untrusted content.

Closing the specification bottleneck requires moving policy authorship up the abstraction stack, away from low-level binary flags and toward Plain-English Constitutions. System designers author a high-level, human-readable document outlining what the software is and isn't allowed to do. An isolated, verifiable compiler pipeline absorbs this abstract intent, transforms it into an immutable runtime policy, and automatically generates behavioral test scenarios to validate the rule boundary before the agent ever takes a real action.

Once compiled, these policies must be enforced through execution-layer invariants that strip the environment of ambient authority:

Zero-Trust Isolation: We cannot rely on the agent choosing to obey a rule. The execution environment must be physically incapable of violating the invariant. If the invariant dictates "no internet egress," the sandbox container must be provisioned with an absolute lack of network interfaces at the OS kernel level.

Object-Capability Models: Agents must operate within micro-sandboxes (such as paravirtualized ParaCell domains using hardware Memory Protection Keys or WebAssembly containers) that enforce explicit object-capability models. Instead of giving an agent access to a file system and asking it nicely not to read sensitive directories, the agent is passed an opaque handle to a specific, isolated data directory. It possesses no concept of an outer environment, completely eliminating path-traversal exploitation vectors.

Proxied Isolation Environments: Every single system or external tool call must be forced to exit the sandbox as a structured request, routing directly through an independent, host-side policy engine (Allow / Deny / Escalate) before it can touch a real interface.

No single layer is sufficient on its own. Plain-English policy compilation keeps invariants maintainable and auditable by humans. Zero-trust isolation makes them physically binding at the hardware level. Proxied call routing gives the alignment critic a clean interception point before any action reaches the real world. Each layer raises the floor the others depend on — and all three are required before the conclusions hold.

10 Conclusions

The arithmetic of the post-zero-day era is unforgiving. When any motivated researcher with API credits can surface critical vulnerabilities for pennies, the reactive cycle of discover, patch, and deploy stops being a defense and becomes a treadmill we have already fallen off.

Survivability can no longer depend on the source code being clean, because we can no longer assume it ever is.

It has to come from the structure of the runtime itself — which means applying the neurosymbolic principle from the first section not just at development time, but permanently, in production: probabilistic agent execution bounded at every step by a deterministic enforcement layer that does not interpret, negotiate, or forget.

By locking the fluid, probabilistic execution plane inside a rigid, symbolic boundary, we ensure that even if the agent is tricked into a semantic detour, the underlying runtime engine simply refuses to execute the violation.

That is the whole program. Give agents capabilities the environment is physically incapable of exceeding; place an independent critic between intent and action, checking every step against what the user actually asked for; and author policy in plain language but compile it into invariants no agent can argue its way past.

We stop trying to prove our code is free of holes, and instead make the holes impossible to act through.

References

On Security Invariants and Agentic Containment
On Autonomous Vulnerability Discovery
On Agent Framework Security Analysis
On Prompt Injection and Compositional Harm
On Isolation and Capability Models
On Formal Verification and Neurosymbolic Systems