Skip to content

ContractWarden: Using human-authorization contracts to delineate harm boundaries for AI agents at the kernel levelContractWarden: Kernel-Enforced Damage Boundaries for AI Agents via Human-Authorized Contracts

arXiv: Jailbreaks, Prompt Injection, Poisoning & Defenses· arXiv:2609.38248· Dongxu Cui, Zhichao Gu, Ping Zheng, Wenshuai Xi, Simeng Han, Yong LiaoSchool of Cyber Science and Technology, University of Science and Technology of China; China Greatwall Technology Group Co., Ltd.Indexed by this site · 2026-10-01· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors propose ContractWarden, a Linux reference monitor that uses human-confirmed asset contracts and the eBPF LSM to restrict the agent's file and network side effects; all 570 runs across 19 safety tests passed.

Threat modelThe system comprises a human authorizer H, a model proposer M, a task domain Aτ, a privileged control plane C, and a kernel enforcer K. The proposer, task commands, agent inputs, and their ordinary descendants are all untrusted and may fork, execute native code, rename files, pass descriptors, relay via supported IPC, connect to the network before reading restricted assets, and attempt identifier reuse; the task has no root or kernel management capability. The kernel, BPF/LSM paths, privileged control plane, and final human input are trusted.

Questions
LLM agents can execute commands, create child processes, and directly access files and the network, so prompt injection or planning errors become operating system side effects; the authors argue application-layer validation is insufficient and that a human-authorized, kernel-enforced asset damage boundary is needed before the task starts.
Methods
ContractWarden separates policy proposal (the model gives a three-state allow/deny/no_egress contract), semantic authorization (human confirmation), and privileged installation; the enforcement gate binds the contract before untrusted code runs, and the eBPF LSM data plane monotonically propagates no_egress state across processes, files, pipes, FIFOs, and Unix sockets.
Experiments and results
All 19 safety properties, each repeated 30 times for a total of 570 observations, passed; median overhead across the three file I/O workloads was 11.96–12.89% on the VM and 35.79–61.54% on the physical machine, both lower than the same-machine frozen ActPlane baseline (Table III).
Limitations and future work
The authors note: undeclared assets are not protected, implicit or byte-level streams are not inferred, not all IPC/device types are covered, and a compromised kernel cannot be resisted; the evaluation uses only one physical machine, one VM, and a file I/O benchmark, with network, concurrent tasks, and real agent workloads left for extension.
Experimental setup19 项安全属性测试(Table IV)、文件 I/O 微基准(10^6 次 open/read/close) et al. · Pass/Run(返回值与副作用判据)、相对 Native 的配对开销百分比(95% bootstrap CI) et al.
Benchmarks
19 项安全属性测试(Table IV)文件 I/O 微基准(10^6 次 open/read/close)14 资产宏基准(700,000 次事务)
Metrics
Pass/Run(返回值与副作用判据)相对 Native 的配对开销百分比(95% bootstrap CI)ring-buffer 丢弃计数
AI summaryContractWarden is a Linux reference monitor that delineates harm boundaries for AI agents at the kernel level through human-authorization contracts, without trusting the agent itself or its policy suggestions. The model can propose three-state asset contracts of allow, deny, or no_egress, but the human makes the final choice; the enforcement gate binds the contract to the specific task before untrusted code runs, and an eBPF-based LSM data plane enforces file and network decisions, with no_egress propagating monotonically across processes, regular files, pipes, FIFOs, and supported Unix-domain sockets. In 570 runs across 19 safety tests, all met the preset return value and side-effect criteria. On three same-machine file I/O workloads, median overhead in a Linux 6.15 VM was 11.96%–12.89%, and on a physical platform it was 35.79%–61.54%, lower than the evaluated frozen ActPlane baseline.

ContractWarden is a Linux reference monitor that delineates harm boundaries for AI agents at the kernel level through human-authorization contracts, without trusting the agent itself or its policy suggestions. The model can propose three-state asset contracts of allow, deny, or no_egress, but the human makes the final choice; the enforcement gate binds the contract to the specific task before untrusted code runs, and an eBPF-based LSM data plane enforces file and network decisions, with no_egress propagating monotonically across processes, regular files, pipes, FIFOs, and supported Unix-domain sockets. In 570 runs across 19 safety tests, all met the preset return value and side-effect criteria. On three same-machine file I/O workloads, median overhead in a Linux 6.15 VM was 11.96%–12.89%, and on a physical platform it was 35.79%–61.54%, lower than the evaluated frozen ActPlane baseline.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    How, without trusting the agent, the kernel continuously enforces the asset-harm boundary that a human authorized before the task.

    Core problem: LLM agents can execute commands, create child processes, and directly access files and the network; prompt injection or planning errors can become operating system side effects. How can a human authorize a damage boundary before the task starts and have the kernel continuously enforce it?

    • Scenario and motivation: indirect prompt injection, malicious tool output, or planning errors can produce real system effects; the authors consider application-layer validation insufficient because a single accepted tool call can expand into a shell, interpreter, native binary, child process, temporary file, and direct system calls.
    • Existing enforcement difficulties (three gaps summarized by the authors): attaching policy only after process creation leaves a race window; process tree inheritance misses lateral movement via files or IPC; checking the network only at connection establishment misses connections already established before sensitive data is read.
    • Threat model:
      • Goal: authorize an asset damage boundary before the task starts, continuously enforced by the kernel.
      • Untrusted parties: the proposer, task commands, agent inputs, and ordinary descendants; they can fork, execute native code, rename files, pass descriptors, relay via supported IPC, connect to the network before reading restricted assets, and attempt identifier reuse.
      • Trusted parties: the kernel, the BPF/LSM path, the privileged control plane, and the final human input; the task has no root or kernel management capability.
      • Victim system: the Linux host running untrusted tasks and its declared asset set R.
    • Proposed approach: ContractWarden, a Linux reference monitor: the model can only propose three-state asset contracts (allow/deny/no_egress), and a human makes the final decision; an enforcement gate binds the contract to the specific task before untrusted code runs; the eBPF LSM data plane enforces file and network decisions and monotonically propagates no_egress.
  2. What related research exists?

    Related work falls into four groups: LSM/eBPF foundations, system provenance and information flow, agent runtime policy, and OS-level sandboxes and the closest system, ActPlane.

    LSM and eBPF mechanism foundations

    • Linux Security Modules and BPF LSM—mediate security-sensitive file, process, and socket operations before the operation occurs; BPF maps hold execution state, and task/inode local storage attaches values to kernel objects rather than reusable numeric identifiers.

    System provenance and dynamic information flow

    • CamFlow, CamQuery—whole-system provenance capture and online analysis; ProTracer, eAudit, TAPAS—reduce or structure audit data volume.
    • Dynamic information flow systems such as TaintDroid—propagate labels between computation and communication. The paper states these systems inspired object-level association, whereas ContractWarden aims to deny authorization before supported side effects occur.
    • AgentSight—uses eBPF events for agent observability; Agent-Warden—process–file provenance for LLM agents (object lifecycle state).

    Agent runtime and framework-layer policy

    • AgentSpec, AgentBound, Progent, Fides, CaMeL—enforce policy in the agent runtime, server sandbox, or trusted planning path. The paper states they provide richer agent semantics and can complement kernel monitors.

    OS-level boundaries and the closest system

    • Seccomp-BPF, AppArmor, Landlock—resource-oriented OS boundaries; the paper notes they cannot automatically express task-conditional rules such as "after reading a certain asset, propagate an egress restriction through an intermediate object."
    • ActPlane (closest)—compiles project and task rules into OS policies with cross-event state and information flow control, targeting programmable compliance policies; the paper states ContractWarden targets a small human-authorized asset boundary, so it compares only overlapping properties and does not treat either side's non-overlapping semantics as a failure.

    Baselines and benchmarks: the comparison baseline is frozen ActPlane (frozen because it requires a Linux 6.15 kernel); evaluation uses the authors' own 19 security property tests and file I/O microbenchmarks/14-asset macrobenchmarks, with no public benchmarks used.

    The authors position this paper as: a kernel-layer enforcer complementary to runtime-layer approaches, differing from ActPlane in that the target is a small human-authorized asset boundary rather than programmable compliance policies.

  3. How does the paper address this problem?

    Contract proposal, human authorization, and privileged installation are separated into three parts; the enforcement gate binds before running, and the eBPF LSM propagates monotonically by object identity and rejects before side effects.

    Overall approach: ContractWarden separates policy proposal, semantic authorization, and privileged installation—the model only proposes contracts, a human confirms each item, and the privileged control plane installs and reads back verification before releasing the task; the kernel data plane makes decisions by object identity rather than path strings.

    Contract and state formalization

    • Humans maintain a declared asset set R; the confirmed contract for task τ is a total function Γτ : R → {allow, deny, no_egress}: allow imposes no restriction, deny rejects supported file/namespace operations, and no_egress allows local access but forbids carriers that acquire this state from using managed network egress.
    • Each task is assigned a non-reused user-space UUID and a bounded kernel slot task_id ∈ [0, 63] (source bit bτ); object state S(x) = ⟨L(x), E(x)⟩, where L is the source bitmap and E is the egress-deny bit, and states merge monotonically as \langle L_1, E_1 \rangle \sqcup \langle L_2, E_2 \rangle = \langle L_1 \lor L_2, E_1 \lor E_2 \rangle.
    • Six safety invariants: closed authorization, binding before execution, object identity, monotonic propagation, deny before side effects (returning EPERM), and fail-closed.

    Authorization and binding before execution (gate-before-exec)

    • The model receives only asset identifiers and metadata, not necessarily canonical local paths; the control plane re-merges the confirmation actions with the local asset table and rejects missing, duplicate, unknown, or out-of-scope actions; the proposer cannot authorize, and humans do not directly modify BPF maps.
    • The launcher creates a child process blocked on a dedicated file descriptor and obtains a pidfd, then sends the pidfd, task identifier, and contract to the daemon over an authenticated Unix SOCK_SEQPACKET channel; the daemon verifies peer credentials and pidfd/PID consistency, installs the asset policy, attaches the task state, and reads back; only after all of this completes does the launcher open the execution gate; on failure the workload remains blocked and is rolled back.

    Compilation, propagation, and denial

    • The control plane resolves existing assets into (device, inode) keys; directory descendants are enumerated, bounded kernel ancestor traversal covers subsequent creations, and paths exceeding 32 ancestor levels are outside the current scope; directory compilation does not follow symbolic links into other trees, and a contract expansion exceeding 4,096 policy keys is rejected.
    • Propagation rules: on process fork, S(Q) ← S(Q) ⊔ S(P); on writable access, S(O) ← S(O) ⊔ S(P); on readable access, S(P) ← S(P) ⊔ S(O). Regular files, FIFOs, and anonymous pipes use inode state; for Unix stream sockets, because the peer inode differs, the sender merges its state into the peer container and the receiver absorbs it.
    • Denial points: if the task source bits intersect the target inode's deny bitmap, the file operation is denied (covering open, create, truncate, unlink, and both ends of rename); a no_egress hit allows file access but sets E(P) = 1 on the same decision path; egress checks occur at socket creation, connect, and send, covering new sockets, established TCP/UDP connections, and connectionless datagrams.
    • exec replaces the program image but does not clear task state; removing an asset rule only stops future matches and cannot revoke an already-held no_egress—the authors say this prevents ordinary tasks from self-decrypting, but it may produce false positives; the trusted release mechanism is deliberately placed outside task permissions.

    Implementation and evaluation method

    • Prototype: ordinary user-space asset/contract tooling, a C launcher and privileged daemon, a policy loader, and a CO-RE BPF data plane; it depends on BPF LSM, BPF Type Format, bpffs, cgroup v2, pidfd, and task/inode local storage; mount points and responsibilities are in Table II.
    • The loader performs bounded JSON parsing and validates contract version, task bits, asset identity and type, action-set disjointness, and BPF map key-value layout; a cross-process lock serializes writers, and on update failure it snapshots and restores the affected keys; audit events go through a ring buffer independent of the LSM return value (256 KiB plus a drop counter), so audit pressure cannot turn a deny into an allow.
    • Safety decisions use system call return values and resource side effects as the primary criterion rather than audit events alone; performance uses paired overhead repeated in the same run as Native (Equation 4), with 5 warm-ups and 30 measurements per configuration, randomized order within repetitions, and intervals from 10,000 bootstrap resamples.
  4. What experiments did the paper conduct?

    19 security properties, 570 observations, all passed; on the same machine, file I/O overhead was 11.96–12.89% on VM and 35.79–61.54% on the physical machine, lower than frozen ActPlane.

    Experimental Setup

    • System under test: ContractWarden prototype; controls are frozen ActPlane (because it requires a Linux 6.15 kernel) and Native (no monitoring).
    • Safety tests: 19 properties (Table IV), each repeated 30 times, with all cases randomized and controlled processes and policies cleaned up between cases; the criterion is system call return values and resource side effects.
    • Performance workloads: two microbenchmarks each executing 10^6 open/read/close transactions (public read, protected read) and one 14-asset macrobenchmark executing 700,000 transactions; 5 warmups + 30 measurements per configuration.
    • Platforms: safety and cost breakdown on Linux 7.0; baseline property tests on a Linux 6.15 VMware guest (8 vCPU); same-machine performance on a Linux 6.15 VM guest and an AMD Ryzen AI MAX+ 395 physical machine (32 logical processors), with absolute times compared only within batches on the same platform.
    • Statistics: paired overhead percentages, 95% intervals from 10,000 bootstrap resamples; model calls and human interaction are not counted in timing.
    • Review method: no LLM review; safety determinations use predefined return-value and side-effect criteria.

    Main Results

    According to Table III (medians of 30 paired trials) and Figure 1:

    Swipe horizontally to read the table

    PlatformWorkloadNative msActPlane overhead [95% CI]ContractWarden overhead [95% CI]
    VMPublic read14864.133.39% [33.04,33.81]11.96% [11.64,12.14]
    VMProtected read14948.161.02% [60.70,61.11]12.89% [12.66,13.05]
    VM14 assets10875.752.44% [52.13,53.16]12.32% [11.90,12.64]
    Physical machinePublic read810.1136.94% [135.89,138.24]58.32% [57.74,58.91]
    Physical machineProtected read830.4170.72% [169.78,172.18]61.54% [60.49,62.37]
    Physical machine14 assets994.0179.03% [178.25,181.35]35.79% [35.48,36.38]
    • The authors state that the bootstrap intervals of the two platforms do not overlap within their respective platforms; the higher percentages on the physical machine are because fixed per-operation overhead accounts for a larger proportion of the faster Native runtime, so platforms must be interpreted separately, and the results are not an overall feature ranking.
    • All 630 trials (including warmups) were valid, content hashes matched, and the maximum drop count over the lifetimes of 210 ContractWarden daemons was 0.

    Safety Correctness (Table IV, Figure 1)

    • What was tested: 19 properties across four boundary categories—isolation (source, sibling, reused identity), propagation (process derivation and each supported persistent/transient carrier), enforcement (newly created and already established network channels, including all four send interfaces used by the harness), lifecycle (rule replacement, installation failure, object release, PID reuse, directory depth boundary).
    • Results: all 570 observations (19 cases × 30 repetitions) passed, with an aggregate ring-buffer drop count of 0; case 19 shows depth 31 matching and depth 32 out of range.
    • Authors' interpretation: within the implemented paths, the monitor maintained source isolation, monotonic propagation, and rejection before side effects; the authors also note that passing fork inheritance does not mean file mediation or peer socket laundering is prevented, hence the need for these four complementary case categories.

    Property Comparison with frozen ActPlane (Figure 1)

    • What was tested: the same 19 properties, with frozen ActPlane first passing a precheck (confirming real eBPF loading and EPERM rejection), with each property executed once.
    • Results: ActPlane was 9 Pass, 3 Fail, 4 Partial, 2 Unsupported, 1 Different; ContractWarden passed all 19 (30 repetitions).
    • Authors' interpretation: the non-passing items mainly reflect the absence of a send-stage enforcement point, creation leaving an empty file before rejection, the absence of Unix peer propagation, and different update, identity or directory semantics; these categories indicate partial comparability or different expression points, not ten generic failures, and these properties do not cover all of ActPlane's temporal policy features; single executions support only coverage observations, not repeated pass-rate estimates.

    Cost Breakdown (Table V)

    • What was tested: four configurations—Baseline (not loaded), Loaded-idle (BPF loaded, task under test not registered), Tracing (task registered, allow-all policy), Full (asset policy enabled).
    • Results: all 420 trials were valid; Full median overhead was 21.16–35.62% (e.g., Full was 35.622% for the protected 10^6 workload and 21.156% for the 14-asset workload); most of the increase occurs between Loaded-idle and Tracing, with a smaller Tracing–Full difference.
    • Authors' interpretation: the authors do not interpret this observation as policy lookup cost being zero.

    Other Ablations and Analyses

    • Cases 3 and 13: establish the necessity of a send-stage enforcement point (send succeeds before infection and fails after infection; send, sendto, sendmsg, and write are all rejected).
    • Case 11: verifies both return values and file system side effects (write/create/truncate/rename/delete leave no prohibited effects).
    • Case 14: six invalid/injection failures all fail to start the target (rejection and rollback before execution).
    • Case 10: 64-bit source isolation—32 targets rejected, 32 controls allowed.
  5. What are some points that can be further explored?

    The authors list three categories of limitations—authorization correctness, lifecycle reuse, and scope and external validity—and give future directions including safe reuse, atomic publication, and trusted decryption.

    Limitations and future directions noted by the authors

    • The guarantee is conditional on the human-confirmed contract: assets may still be omitted or chosen too permissively; human confirmation only decides who authorizes the boundary, not whether the authorization is objectively correct; usability, decision time, alert fatigue, and contract quality require user studies (V.A).
    • Permission-level propagation may approximate "writable" as "actually affected" and thus over-taint tasks; restoring egress requires a trusted decryption mechanism (e.g., an attested conversion or an independently authorized release) (V.A).
    • The 64-bit source representation makes joins fixed-width but limits the active namespace; cgroup draining only proves the derived task tree exited, not that every persistent inode or receiver outside the cgroup dropped the source bit; safe reuse requires generation labels, global liveness tracking, or conservative non-reuse (V.B).
    • Multi-key updates are serialized and rolled back on failure, but are not linearizable for concurrent kernel readers; a double-buffered map with a one-key generation switch is a natural extension (V.B).
    • The prototype does not cover undeclared assets, implicit or byte-level flows, all IPC/device classes, hosts with root compromised, general in-task decryption, or destination allowlists (V.C).
    • Future directions (Conclusion): safe source reuse, atomic policy publication, trusted decryption, real concurrent agent workloads; V.C also lists extensions for networking, fork/IPC, updates, concurrent tasks, and multi-kernel evaluation.

    Experimental coverage

    • The security evaluation is 19 properties × 30 repetitions, with criteria being return values and side effects; the ActPlane comparison executes each property only once.
    • The performance evaluation uses one VMware guest (8 vCPU) and one AMD Ryzen AI MAX+ 395 physical machine, with workloads being file I/O microbenchmarks and 14-asset macrobenchmarks; the paper states that one physical machine, one VM, and file I/O benchmarks cannot represent all agent workloads.
    • Security, cost breakdown, and same-machine measurements come from different kernel batches (Linux 7.0 and 6.15), and the paper does not compare absolute times across batches.
    • Timing covers steady-state workload execution and excludes engine startup, model proposal, and human confirmation.
    • The experiments did not run any LLM; performance runs used deterministic proposals, and the paper does not report which specific model was used for proposals.
  6. Summarize the main content of the paper

    ContractWarden delineates the agent damage boundary at the kernel layer using a human-confirmed three-state contract and eBPF LSM, with all 570 security observations passing.

    A systems security paper: addressing the problem that prompt injection and planning errors against LLM agents become operating system side effects, it proposes a Linux reference monitor, ContractWarden, that enforces a human-authorized damage boundary without trusting the agent or its policy proposals.

    • Problem: application-layer validation is insufficient against tool calls that unfold into shells, child processes, and direct system calls; existing enforcement has three gaps: a race where policy is attached after creation, process-tree inheritance missing file/IPC transfers, and checking only connection establishment while missing already-established connections.
    • Method: the model only proposes a three-state asset contract of allow/deny/no_egress, a human confirms each item, and the privileged control plane installs and reads it back before releasing the task; the enforcement gate plus pidfd achieves bind-before-run; the eBPF LSM data plane attaches source bits and no_egress state to task and inode objects, monotonically joins them at process, regular file, pipe, FIFO, and Unix socket edges, and checks egress at socket creation, connection, and send.
    • Security results: 19 properties × 30 repetitions, 570 observations total, all passed, with an aggregate ring-buffer drop count of 0 (Table IV); on the same property set, frozen ActPlane in a single run was 9 Pass, 3 Fail, 4 Partial, 2 Unsupported, 1 Different (Figure 1), which the authors state reflects coverage differences rather than general failure.
    • Performance results: on the same machine, file I/O median overhead was 11.96–12.89% on VM and 35.79–61.54% on the physical machine, lower than frozen ActPlane's 33.39–61.02% and 136.94–179.03% (Table III); the authors emphasize that platforms must be interpreted separately and that this is not an overall feature ranking.
    • Authors' conclusion: within the scope of declared assets, implemented kernel paths, and object lifecycle constraints, a human-authorized contract can be deterministically translated into task-bound kernel state; the guarantee is conditional on the human-confirmed contract, undeclared assets, implicit flows, and a compromised kernel are out of scope, and real concurrent agent workloads are left for future work.
Read originalarxiv.org