Manuscript Offprint

arXiv:2610.18457

Kairos: Transactional Security Enforcement at the System Boundary for LLM Agents

Kristoffer Hempel, Nils Loose, Lorenzo Cavallaro, Thomas Eisenbarth

Kristoffer Hempel 1^{1} Nils Loose 1,2^{1,2} Lorenzo Cavallaro 2,3^{2,3} Thomas Eisenbarth 1^{1}

1^{1}Universität zu Lübeck 2^{2}University College London 3^{3}Mohamed bin Zayed University of Artificial Intelligence

Abstract—Large language model (LLM) agents are becoming an integral part of the software development lifecycle, and the capabilities granted to them allow an agent to act with the user's authority on any resource it can access. The reach that gives an agent its utility is equally available to an attacker who can steer it. Anything an agent ingests can carry an injected instruction, and since the model does not reliably distinguish instructions from data, indirect prompt injection should be mitigated by mediating the effects the agent produces. Such mediation faces a structural difficulty. Legitimate work and the first step of an attack often look alike when an individual action is observed, and what separates them lies later in the trace, so a monitor limited to allow and deny is forced to decide before the evidence accumulates. We present KAIROS, a reference monitor at the isolation boundary of an unmodified, opaque agent, where a tool call, a shell command, and a script the agent writes all cross the boundary as the same file and network operations, so that confinement holds regardless of the agent's behavior. A declarative policy that states which sources are trusted decides most effects deterministically and defers the rest, which are held while the agent continues speculatively. A decision oracle with bounded authority, such as a language model or a human, releases or refuses each deferred effect on the trace. Across three benchmarks and three agent models, KAIROS outperforms existing defenses in the trade-off between attack success and utility. In particular, on AgentDojo, it reduces attack success from 47.0% to 2.7% while its benign utility stays at the level of the undefended agent.

Index Terms—LLM Agent security, indirect prompt injection, reference monitor, sandboxing, transactional rollback

I. INTRODUCTION

LLM agents are increasingly deployed to act autonomously on behalf of users and organizations, operating on code bases, infrastructure, and communication channels over tasks that run for hundreds of steps without review [1], [2]. Their value hinges on the breadth of their access: to be useful, an agent reads broadly, executes code on the host, and reaches the network, all with the authority of the principal. Coding agents are the most prominent example, as they are routinely handed a repository, a shell, and network access. With this authority, an agent's effects reach far beyond its principal, through the code it commits, the packages it publishes, and the requests it sends. Recent incidents show that agents can compromise infrastructure far outside their task [3], [4].

This broad set of capabilities and access offers an unprecedented attack surface as everything the agent, and consequently the model, ingests enters the same context as the user's instructions without any systematic differentiation between control and (untrusted) data content [5]. This leaves the agent fundamentally vulnerable to indirect prompt injections [6] from an attacker who controls any part of the ingested content. As these agentic systems have already seen widespread public adoption despite the unprotected attack surface, recent attacks highlight the risk that unprotected deployment brings [7]. Repository content ingested by a coding assistant has been used to exfiltrate private SSH keys [8], inbound channels such as calendar invites have been used to steer assistant systems against the user's intent [9], and memory files used by agentic systems have been used to enable attack persistence [10]. Several of these attacks required no software vulnerability and used only the permissions the agent had legitimately been granted [10]. A public adaptive-injection challenge further showed that participants defeat deployed defenses given the opportunity to iterate [11].

Existing defenses against prompt injection commonly operate at the level of the prompt, the model, or the agent framework [12]–[16], and treat the environment in which the agent executes as given. Prompt- and model-level defenses make it less likely that the agent follows injected instructions, but provide no structural guarantee that it does not [12], [13], [17]. Framework-level defenses provide stronger, structural guarantees by enforcing policies on the agent's actions, but require a custom or modified harness [14]–[16], [18]. This excludes closed-source agents, and any guarantee has to be re-established whenever the agent is updated. They also mediate only relative to a declared interface, such as the agent's set of tools, so that complete mediation, the first requirement of a reference monitor [19], becomes an assumption about the deployment rather than a property of the mechanism [20]. A script the agent writes and runs remains outside their reach. Only a few approaches monitor agents at the operating-system level, and these either observe their actions [21] or block and terminate them as they occur [22], [23]. At the same time, agents are increasingly executed in sandboxes and virtual machines [24]–[26]. Such isolation is necessary to mediate every effect regardless of how the agent produces it, but it is not sufficient. An injected agent acts as a confused deputy [27] that stays within the authority it was granted while violating the intent of its task.

Isolation determines where an agent’s effects can be stopped, but not which ones should be. Following the example in Fig. 1, an agent is, while setting up a repository, prompted by external content to set up a pre-commit hook. The policy cannot vouch for this write, as it stems from untrusted content, yet it also cannot refuse it without broadly harming utility. Refusing it breaks legitimate setups, while releasing it leaves

Figure

Fig. 1. Deferral in KAIROS. Eve's guide injects a hook the policy cannot vouch for, so the write is deferred. The agent continues, its commit runs the hook, and the hook's attempt to exfiltrate Alice's key is refused by the policy. On this evidence, the oracle discards the hook.

a planted hook in the repository, even if the malicious action is later detected. What separates the two cases appears only once the hook runs, and a monitor that must decide each effect on arrival cannot wait for it [28]. The monitor must therefore be able to defer and hold the write [29], letting the agent continue speculatively on a staged state [30]. This allows the decision to be postponed until the consequences are visible, yet before anything becomes irreversible.

We present KAIROS, a reference monitor at the isolation boundary of an unmodified, opaque agent. Because the monitor sits at this boundary, every effect of the agent crosses the monitor as the same kind of event, whether it stems from a tool call or from a script the agent wrote. This design guarantees confinement against a fully compromised agent, whatever the cause of its misbehavior. Since every effect crosses the monitor before it is released, the boundary also yields a complete record of the agent's effects and a point at which a human can intervene. By tracking provenance at the boundary and recording a trace of the agent's effects, the monitor enables authorization of each effect against the agent's previous steps. Combining a declarative policy with an external decision oracle lets the monitor decide effects the policy covers as they occur and defer the remaining ones to the point of irreversibility.

We implement KAIROS by running agents in a microVM managed by Cloud Hypervisor [31]. To enable deferral, file effects are staged in an overlay layer [32] and exported through FUSE [33], while network effects pass through a TLS-terminating proxy [34] that stalls requests until they are resolved. Mediation adds about 1.9 ms per file operation and 1.2 ms per request, negligible next to model inference. The decision oracle is a language model by default, following existing defenses that check an agent's actions against its task [17], and can be replaced by a human reviewer or a policy engine.

Across three benchmarks and three agent models, KAIROS outperforms existing defenses by achieving the highest net resilient performance [35], which equally weights attack success and utility. On AgentDojo [36], KAIROS reduces attack success from 47.0% to 2.7% while benign utility stays at the level of the undefended agent (85.1% against 82.7%). The framework-level defenses we compare against either reach slightly lower attack success at less than half the utility, or trail KAIROS on both. A strict configuration that refuses whatever the policy cannot vouch for leaves attack success unchanged within run-to-run noise but completes only 42.7% of benign tasks, so deferral and the oracle together recover the utility at no measurable cost in security. This holds on open-ended tasks, on which defenses that fix their plan in advance complete almost no work, and against an adaptive attacker that rewrites its injections against KAIROS.

In summary, we make the following contributions:

• KAIROS, a reference monitor for unmodified, opaque agents that guarantees confinement at their isolation boundary and defers the effects it cannot authorize, holding them while the agent continues speculatively until a decision oracle decides them (Sections II and III).

• An implementation for coding agents that requires neither modification of nor cooperation from the agent, holding file and network effects at a microVM boundary with about two milliseconds of overhead per mediated operation (Section III-D).

• A comprehensive evaluation across three benchmarks, three agent models, and an adaptive attacker, in which KAIROS achieves the best trade-off between security and utility (Section IV).

References (68)