Manuscript Offprint

arXiv:2610.26501

Connection Escrow: Holding AI-Agent Pod Egress in the Kernel Until an Isolated Verifier Rules

Ashok Subbabhatta Gopalakrishna

Ashok Subbabhatta Gopalakrishna

Abstract—AI agents running in containers act on the world by opening network connections, and the text that drives them can be hostile. Controls placed between the agent and its tools, such as gateways, SDK hooks and proxy settings, can be bypassed by a child process or a direct socket, and even when they are not bypassed, their approval is not tied to the connection the kernel later opens. We present connection escrow: every outbound TCP connection from a supervised pod is parked inside the kernel's connect() path, before any packet exists, by a 98-instruction eBPF program attached to the pod's cgroup. An interceptor on the node attributes the held socket to its kernel socket cookie, process, executable digest, cgroup and pod identity, parks the first bytes the agent writes (HTTP request line or TLS ClientHello), and asks a verifier that runs in a separate container with its own key. The connection is released only on a signed verdict that names that one socket cookie and destination, is unexpired and unused; no verdict by the deadline resets the connection, and a late approval is refused. The agent is unmodified. We implement the system (Python plus eBPF, with an iptables fallback) and evaluate it two ways. A 36-check adversarial suite on Linux 6.18 with real cgroups and uid-separated agent processes passes on both hold points (the three UDP-pinning checks need the kernel path): refused connections never reach the destination, forged, rebound, replayed, expired and late verdicts are refused, the agent's own attempt to reach the verifier is escrowed and refused, child-process and renamed-binary bypasses fail, and UDP is pinned to the cluster resolver. On a single-node Kubernetes cluster, an unmodified agent pod is held per connection and attributed to its SPIFFE identity; a raw socket that bypasses a comparison sidecar proxy is held by escrow; and six pods opening 600 connections are all gated. The hold adds 4.3 ms median (6.8 ms p95) per released connection on loopback, of which 24 μ\mus is policy evaluation; the rest is attribution, one HTTP round trip and two signatures. Finally, we extend escrow to gate on request content without terminating TLS: an eBPF uprobe reads every plaintext write at the agent's TLS-library boundary, a model scores it, and each TLS record is held until the write that produced it is scored, while the TLS session stays end-to-end to the real server with the real certificate and the enforcer holds no key. The gate is demonstrated on three runtime shapes with two kernel programs — shared OpenSSL, statically linked OpenSSL (the BoringSSL shape) and Go's crypto/tls — against the keep-alive exploit that defeats a first-record check: on one connection a benign request is allowed and an exfiltration request that follows it is denied on its captured plaintext, so the server receives only the first. What decides a verdict is deliberately pluggable and out of scope.

Index Terms—AI agents, eBPF, Kubernetes, egress control, workload identity, runtime enforcement, time-of-check to time-of-use.

1 INTRODUCTION

A N AI agent that can call tools can open network connections: to fetch a page, to post to an API, to close a ticket, to push a commit. The decision to do so comes from text the agent was given, and some of that text is written by whoever wants the agent to misbehave. The question this paper asks is narrow: once the agent has decided to connect, where can the decision be checked by something the agent cannot influence or bypass, and how can the check be bound to the connection that actually happens?

Today’s answers sit at the application layer. A gateway inspects tool calls; an SDK hook vetoes them; a sandbox sets a proxy environment variable. Each is bypassed by a tool that opens its own socket, by a child process, or by a runtime that ignores the proxy setting. Kernel-level policy closes that gap but, in the systems we know of, applies a standing allow-list: once a destination is permitted, it is permitted for every connection, by every process in scope, for as long as the policy is loaded. Nothing ties a particular approval to a particular socket.

We propose to escrow the connection. The kernel parks it at connect (), before a SYN exists; a node-local interceptor attributes it to the socket, the process and the pod; a verifier in a separate container rules; and the interceptor releases exactly the socket the verdict names, once. If no verdict arrives in time, the connection is reset. The verifier is a destination like any other, so the agent cannot reach it: its attempt is escrowed and refused.

The contributions are:

  1. A kernel hold point for pod egress. A cgroup/connect4 eBPF program records the socket cookie, original destination, cgroup id and pid of every TCP connect() from the supervised cgroup and rewrites the destination to the interceptor (Section 3.2). An iptables REDIRECT keyed on the agent's uid gives the same hold point without eBPF.

  2. An attribution record that joins the kernel view to the platform view. Socket cookie, inode and uid

from inet_diag; pid, cgroup, executable digest and comm from the eBPF map and /proc; pod uid, namespace, service account and SPIFFE id from a registry keyed on the cgroup path (Section 3.3).

  1. A release gate bound to one socket. A verdict is accepted only if it is signed by the verifier, names the escrow id, the socket cookie and a hash of the destination and the parked first bytes, is unexpired and unused, and arrives before the deadline (Section 3.8). Hold-and-release lets an operator decide later, inside the deadline (Section 3.9).

  2. Content gating of encrypted connections without terminating TLS (Section 3.7). An eBPF uprobe on the agent's TLS library — shared OpenSSL, statically linked OpenSSL/BoringSSL, or Go's crypto/tls, two kernel programs in all — reads every plaintext write at the library boundary, before encryption; the interceptor holds each application-data record until the write that produced it is scored, so a second request on a kept-alive connection is gated like the first; and the connection stays end-to-end to the real server, with the real certificate, the enforcer holding no key. This gates on what the agent sends, not only where, while keeping the tunnel intact.

  3. An implementation and a measured evaluation. Python and eBPF, 36 adversarial checks on the eBPF hold point (33 of which apply to iptables), a latency breakdown with and without native cryptography, a Kubernetes run, and the content-gate demonstration (Section 6). Everything reported comes from logged runs of experiments/run_all.sh and the cluster drivers.

What is not in this paper: the logic that decides whether a connection is acceptable. The verifier ships with a rule engine (destination by SNI, host or address; port; HTTP method and path prefix; per-workload budgets; operator hold), and the content gate ships with a placeholder classifier. Any function from an attribution record, or a captured request, to a verdict can replace either. The paper is about where the check runs and what binds its answer to the connection.

References (18)