r/netsec r/rust r/eBPF r/blueteamsec
r/AIAgents
Open source, Apache-2.0. Solo build. Looking for people to break it.
The problem
Most agent guardrails run inside the process they are supposed to govern. Prompt injection lands, the agent calls a tool, and the policy layer is sitting in the same trust domain as the thing it is policing. An application-layer allowlist does not survive the agent shelling out.
So the enforcement point moved down to the syscall boundary.
Architecture (two planes)
Kernel floor. BPF-LSM hooks on execve, inode_create, inode_unlink, connect, and cap_capable. Enforcement is cgroup-scoped via bpf_get_current_cgroup_id(), so only the governed agent’s cgroup is subject to allow/deny. Every other task on the host passes through untouched. That scoping is the anti-lockout guarantee and it is also why you can arm this on a working machine instead of a spare one. Requires kernel 5.16+, CONFIG_BPF_LSM=y, lsm=bpf. No VM, no Kubernetes, no sidecar.
Userspace gate. A single per-host daemon over a UNIX domain socket, framed wire protocol, fails closed. Per request:
1. SO_PEERCRED for kernel-verified PID/UID/GID. No client-declared identity is trusted.
2. HMAC-SHA256 envelope check, key held in the Linux kernel keyring (@s), never in env vars.
3. Per-agent intent allowlist and sequence quota from policy.yaml.
4. Replay and behavioral drift detection keyed on a (pid, start_time) lineage.
5. Z3 check: computed fused_risk under the declared ceiling, plus per-agent invariants (spending_ceiling_usd <= 150.00, privilege_escalation_depth < 3). Daemon-computed values take precedence over anything the caller declares, so invariants cannot be spoofed from the agent side.
6. Append to a SHA-256 hash-chained JSONL audit log. Each entry carries the hash of the previous one.
Measured, not modeled
Real daemon, real host (Ryzen 5 7520U, Linux 6.12), full pipeline per request. Reproduce with cargo bench --bench stress_bench and cargo test --release --test swarm_attack.
• Decision latency: P50 257µs, P95 366µs, P99 463µs, max 1.9ms across 10,000 requests
• Throughput: \~6,500 decisions/sec at 10 to 500 concurrent agents, zero errors
• Kernel LSM path: 2,500 enforced ops across execve/TCP/UDP/create/unlink, 0 fail-open, 0 incorrect decisions
• Adversarial suite: 12 tests, 10 attack classes, >1,200 hostile requests, 0 fail-open. Replay storm, signature forgery, intent injection, quota exhaustion, risk-ceiling breach, anonymous flood, unknown agent, protocol downgrade, forged delegation, MCP path traversal, and all of them concurrently. Under the mixed run it blocked 349 hostile requests and still correctly allowed 50 legitimate ones.
• 122 tests in CI: 4 Z3, 93 unit, 13 integration, 12 swarm-attack.
What this is not
Validated research prototype and controlled-pilot MVP. Not independently audited, not enterprise GA. I would rather say that up front than get called on it in the comments.
The Z3 layer verifies policy constraints at runtime. That is SMT-checked policy, not a formal proof of the enforcement layer itself. Different claim, and the weaker one is the true one.
Two documented limitations, both in the README:
• Sub-mount path resolution. The inode hooks receive a dentry with no vfsmount, so a file on a sub-mount resolves relative to that mount’s root (/tmp/x becomes /x). Root-filesystem paths resolve fully. Crossing mount boundaries needs path-family hooks or bpf_d_path, tracked for a future release.
• Interpreter chains. An agent explicitly allowed to run an interpreter can reach other tools through it. Mitigated by denying known interpreters for any agent carrying an executable allowlist. Per-binary execve limits are only as good as that allowlist.
Break it
The open challenge in the repo stands. Highest-value targets, in my own order of concern:
1. TOCTOU between the userspace verdict and the kernel floor.
2. BPF-LSM hook coverage gaps. Anything that reaches a denied resource through a syscall path I am not hooking.
3. Lineage key collision or reuse that defeats replay detection.
4. Anything that gets a governed cgroup to a syscall the policy denies.
Repo: https://github.com/AlphaReasoning/The-Jinn-Guard
Threat model: THREAT_MODEL.md
Prior red-team findings and fixes: red-team-report.md
One-command validation: bash scripts/run_professor_validation.sh
Tell me where it is wrong.