LotAGuard: Enforcing MCP-to-Kernel Capability Boundaries via eBPF

LotAGuard (arXiv:2612.03557) is a sub-millisecond cross-layer security monitor for Linux eBPF and Windows Sysmon/ETW that bridges Model Context Protocol (MCP) tool calls and OS process trees. Formalizing Living-off-the-Agent (LotA) compromises, it detects 16/16 Class-I cross-boundary attacks on AgentDojo and InjecAgent with zero false positives while keeping resident state under 15 KB across 14-day soaks.
LotAGuard: Enforcing MCP-to-Kernel Capability Boundaries via eBPF: LotAGuard (arXiv:2612.03557) is a sub-millisecond cross-layer security monitor for Linux eBPF and Windows Sysmon/ETW that bridges Model Context Protocol (MCP) tool calls and OS process trees. Formalizing Living-off-the-Agent (LotA) compromises, it detects 16/16 Class-I cross-boundary attacks on AgentDojo and InjecAgent with zero false positives while keeping resident state under 15 KB across 14-day soaks. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- 100% Class-I Detection (16/16): Blocks ungrounded secret reads, persistence writes, async child/IPC escapes, and dormant rule triggers on AgentDojo and InjecAgent with 0% false positives.
- 0% Blocking False Positives on SWE-bench: Evaluated across 100 SWE-bench Verified engineering tasks and 1,430 sessions with only a 1% step-up prompt rate.
- Incarnation-Safe Causal Stitching: Binds MCP rpc_id envelopes to OS process cones across rapid PID recycling, deferred background tasks, and multi-week uptime in <15 KB RAM.
- Hunk-Blame Differential Lineage: Audits persistent instruction files (.cursorrules, AGENTS.md, CLAUDE.md) per diff hunk rather than whole-file taint, eliminating taint explosion.
import { createAgent } from '@smoke-monkey/harness';// Enforce strict MCP tool capability boundaries alongside Smoke Monkey permission gatesconst agent = createAgent({agentId: 'lotaguard-hardened-coder',provider: 'openai-compatible',baseUrl: 'http://127.0.0.1:8000/v1',model: 'Qwen/Qwen3.8-27B',workspacePath: process.cwd(),mcpServers: {filesystem: {command: 'lotaguard-wrap',args: ['--ebpf-cone', 'read_only_workspace','--prompt-grounding', 'semantic','--', 'npx', '-y', '@modelcontextprotocol/server-filesystem', process.cwd()],},},permissions: {read_file: 'allow',write_file: 'ask',run_command: 'ask',},});async function main() {const result = await agent.run('Fix the off-by-one clamping bug in src/app.py and run pytest without reading outside the repository.');console.log('Verified execution summary:', result.summary);}main().catch(console.error);
Watch: Related Video Guides
Model Context Protocol Clearly Explained | MCP Beyond the Hype
What is MCP? Integrate AI Agents with Databases & APIs
What Is Living-off-the-Agent (LotA) and LotAGuard?
Living-off-the-Agent (LotA) describes post-exploitation-style compromises where an autonomous coding agent abuses legitimate Model Context Protocol (MCP) tools—spawning shells, running pytest, editing config files, or opening sockets—to execute unauthorized OS actions. LotAGuard (Canale & Soulis, arXiv:2612.03557) is a sub-millisecond cross-layer monitor combining Linux eBPF hooks and Windows Sysmon/ETW events to enforce capability boundaries per MCP rpc_id.
Crucially, LotAGuard draws an explicit boundary between Class-I cross-boundary attacks (ungrounded reads of .ssh/.env, persistence writes, asynchronous child/IPC escapes after an RPC returns, and dormant .cursorrules triggers) and Class-II in-envelope semantic attacks (backdoors written inside an authorized source file).
| Defense Approach | Kernel Visibility | Cross-Platform (Linux+Win) | MCP rpc_id Attribution | Async Post-RPC Escapes | Avoids Taint Explosion | Rarity-Weighted Quirk Scoring |
|---|---|---|---|---|---|---|
| Signature EDR (Falco 0.45 / Sysmon) | Yes | Single-OS only | No | Partial (no RPC) | Yes | No |
| OS Provenance (HOLMES / UNICORN) | Yes | Yes | No | Yes | No (graph drift) | Partial |
| LLM Policy / Arg Guards (CaMeL / Progent) | No | Yes | Args only | No | Yes | No |
| LotAGuard (eBPF + ETW) | Yes | Yes | Yes (incarnation-safe) | Yes (cone binding) | Yes (hunk-blame) | Yes (1% step-up) |
Incarnation-Safe Causal Attribution, Rarity Weights, and Hunk-Blame
Conventional EDRs fail on coding agents because benign git_status or compiler runs trigger frequent harmless kernel quirks (e.g., loop:temporal_errno occurs 90 times per 100 benign runs). LotAGuard solves this with three mechanisms:
- Incarnation-Safe Process Cones: Every OS process is keyed by
(pid, incarnation_gen)and bound to its originating MCPrpc_id. Even if an attacker spawns a detached background process that waits until after the RPC response (t > t_r) or recycles PIDs over a 14-day uptime, the monitor preserves exact attribution in under 15 KB of resident memory. - Rarity-Weighted Violation Contracts: Common benign quirks receive near-zero weight (
w = 0.023forloop:temporal_errno,0.136formcp:git_status:forbidden_write), while high-signal violations carry heavy weight (w = 0.820formcp:http_fetch:undeclared_net_port,w = 0.880formcp:read_file:ungrounded_sensitive_read). - Hunk-Blame Differential Lineage: Instead of tainting an entire repository when an agent touches
.cursorrulesorCLAUDE.md, LotAGuard isolates only the newly added diff hunks, blocking dormant instruction poisoning without breaking legitimate refactor sessions.
Know the Class-II Boundary Limits
In Series G stress tests, LotAGuard intentionally scored 0/4 on Class-II in-envelope edits (such as inserting a logic backdoor into an authorized src/auth.py file or staging a grounded .env into docs/notes.md). Always pair runtime kernel envelopes with SAST, gitleaks pre-commit hooks, and human PR review.
Reproducible LotAGuard Deployment and Boundary Testing
Clone the open-source LotAGuard implementation to attach eBPF capability cones to your MCP servers and run the Series G/H boundary verification suite:
# 1. Clone LotAGuard repository (Linux eBPF + Windows ETW cross-layer monitor)
git clone https://github.com/jeremy1392/LotAGuard.git
cd LotAGuard
# 2. Verify kernel BTF support for Linux eBPF lsm/file_open and tcp_connect hooks
ls -la /sys/kernel/btf/vmlinux
# 3. Run the deterministic boundary & SWE-bench benign calibration suite
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
pytest tests/test_boundary_series_g.py tests/test_causal_cone.pyFrequently Asked Questions
Q:What is the difference between Class-I and Class-II agent attacks in LotAGuard?
Class-I attacks cross OS or protocol capability boundaries—such as reading ~/.ssh keys, writing persistence scripts, or spawning post-RPC network shells—and are caught 16/16 by LotAGuard. Class-II attacks stay inside authorized file envelopes (e.g., planting a logic bug in an approved source file) and require SAST or code review.
Q:How much memory and latency overhead does LotAGuard add?
LotAGuard operates with sub-millisecond per-syscall monitoring overhead and maintains under 15 KB of resident tracking state over a 14-day continuous soak test.
Q:Does LotAGuard block normal coding agent tools like pytest or git?
No. Across 100 SWE-bench Verified tasks, LotAGuard produced zero blocking false positives and only 1% step-up confirmation prompts by down-weighting common benign OS quirks via rarity scoring.
Q:Why does LotAGuard track raw UDP DnsQuery / udp_sendmsg in Mode 3?
Mode 1 hooks TCP connect calls, which misses raw UDP DNS exfiltration tunnels (case E3 in Series G). Enabling Mode 3 udp_sendmsg on Linux or Sysmon EID 22 on Windows closes DNS side-channel egress.
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.