Skip to content
ejames-devPublic

About

Deterministic network-layer Dynamic Information Flow Tracking (DIFT) and monotonic capability-attenuation gateway for AI agents.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

NetDIFT

CI Rust 1.85+ Zero LLM Judge License: MIT

Deterministic network-layer Dynamic Information Flow Tracking (DIFT) & monotonic capability-attenuation gateway for AI agents.

When organizations deploy internal AI agents (coding, SRE/DevOps, triage, MCP-connected research agents), attackers don't need to hack your model weights—they hijack your trusted agents via indirect prompt injection hidden in public GitHub issues, external web pages, support tickets, or compromised MCP servers, turning your own agent into an automated insider pivot (secret exfiltration, lateral CI/CD & MCP writes, DNS tunneling, or multi-agent worm propagation).

Putting another LLM in front as a "prompt-injection firewall" is probabilistic, slow, and bypassable. NetDIFT enforces formal Dynamic Information Flow Tracking (Bell-LaPadula × Biba) and monotonic capability attenuation directly at the network/wire layer in Rust—model-agnostic, framework-agnostic, and deterministic even when the underlying LLM is 100% jailbroken.

NetDIFT Dynamic Information Flow Tracking and Capability Attenuation Flow


How It Works

   [ Internal AI Agent (Claude Code / LangGraph / MCP Client / Custom Script) ]
                                       │ (HTTP / MCP JSON-RPC / A2A / UDP DNS)
                                       ▼
         ┌────────────────────────────────────────────────────────────┐
         │ 1. 2D Epistemic Security Lattice  (L = Integrity × Conf)  │
         │    • Integrity (Biba):  Trusted ⊏ SemiTrusted ⊏ Untrusted  │
         │    • Confidentiality:   Public  ⊏ Internal    ⊏ Confidential│
         │    • Monotonic Join ⊔:  labels only climb upward           │
         ├────────────────────────────────────────────────────────────┤
         │ 2. Wire-Layer Capability Attenuation                       │
         │    • Untrusted → hard-drop control-plane writes &          │
         │      privileged MCP tools/call (including batch arrays!)   │
         │    • Untrusted ∧ Confidential ("Lethal Trifecta") →        │
         │      hard-drop non-allowlisted HTTP egress & URL exfil     │
         ├────────────────────────────────────────────────────────────┤
         │ 3. RFC 1035 UDP DNS Entropy Guard                          │
         │    • Shannon entropy + subdomain split-label detection     │
         │    • REFUSED (RCODE=5) on secret DNS tunneling             │
         ├────────────────────────────────────────────────────────────┤
         │ 4. Cross-Agent Provenance & Scoped Human Declassification  │
         │    • HMAC-SHA256 X-NetDIFT-Provenance stops taint          │
         │      laundering across peer agents (multi-agent worms)     │
         │    • Single-use, replay-guarded X-NetDIFT-Declassify       │
         └─────────────────────────────┬──────────────────────────────┘
                                       │
                  ┌────────────────────┴────────────────────┐
                  ▼                                         ▼
       [ Allowed Upstream / Peer ]        [ 403 / REFUSED · ECS SIEM · Loopback UI ]

For the formal lattice laws, cryptographic header specifications, and threat model, see docs/ARCHITECTURE.md.


Quickstart

Pre-built binaries

Download a release archive for Linux (static musl, x86_64/aarch64), macOS (x86_64/arm64), or Windows (x86_64) from GitHub Releases, then verify it:

sha256sum -c SHA256SUMS.txt --ignore-missing
tar -xzf netdift-v0.1.0-x86_64-unknown-linux-musl.tar.gz
./netdift-v0.1.0-x86_64-unknown-linux-musl/netdift demo

Build from source

Requires Rust (stable, Edition 2021).

# Build release binary
cargo build --release

# 1. Run the flagship 8-step live red-team containment demo (real TCP/UDP loopback sockets)
#    Vault Secret -> Poisoned GitHub Issue -> Blocked Exfil, CI/CD + MCP Pivot,
#    DNS Entropy Tunnel, Cross-Agent Worm Laundering, and 1x Human Declassification!
./target/release/netdift demo \
  --ecs-out out/netdift.ecs.jsonl \
  --html out/forensic_report.html

# 2. Run the demo and keep the zero-CDN live Admin Web Console open on http://127.0.0.1:8091
./target/release/netdift demo --keep-alive

# 3. Run the reproducible 5-scenario containment & wire-latency benchmark
./target/release/netdift bench --sessions 10

# 4. Run NetDIFT as a live HTTP/MCP/A2A proxy + UDP DNS guard + loopback Admin Console
export NETDIFT_SECRET="$(openssl rand -hex 32)"
export NETDIFT_ADMIN_TOKEN="$(openssl rand -hex 24)"
./target/release/netdift serve --policy policies/default_policy.yaml

# 5. Mint a single-use, strictly scoped human declassification token
NETDIFT_SECRET="..." ./target/release/netdift declassify \
  --session sess-agent-a \
  --method POST \
  --host ci.internal \
  --path /api/v1/deploy \
  --approver alice@acme.corp \
  --reason "Reviewed release diff"

# 6. Verify a captured X-NetDIFT-Provenance cross-agent header offline
NETDIFT_SECRET="..." ./target/release/netdift verify-provenance "v1.<payload>.<mac>"

CLI Commands

Command Purpose
netdift demo Runs a self-contained 8-step red-team simulation over real local TCP & UDP sockets proving deterministic containment of HTTP exfil, CI/CD & MCP pivots, DNS tunneling, and cross-agent worm laundering, plus single-use human declassification and replay blocking.
netdift serve Starts the bounded HTTP/MCP/A2A wire proxy (127.0.0.1:8090), UDP DNS entropy guard (127.0.0.1:5353), and authenticated loopback Admin Web Console (127.0.0.1:8091) with optional live --ecs-out SIEM stream.
netdift bench Evaluates Clean-Agent False-Positive Rate, Attack Containment Recall, and Wire Overhead (µs) across 5 labeled security cohorts.
netdift declassify Mints a single-use, HMAC-signed, tightly scoped X-NetDIFT-Declassify checkpoint without resetting session taint.
netdift verify-provenance Verifies and decodes an X-NetDIFT-Provenance cross-agent taint header offline in constant time.

Reproducible Benchmark Results

Run ./target/release/netdift bench --sessions 10 to reproduce locally:

Scenario Cohort Sessions Evaluated Allowed Blocked Mean Wire Overhead Accuracy
clean_agent_workflows 10 40 40 0 ~2.9 µs 100.0%
poisoned_http_exfiltration 10 10 0 10 ~4.6 µs 100.0%
poisoned_control_plane_mcp 10 20 0 20 ~3.0 µs 100.0%
dns_entropy_tunneling 10 10 0 10 ~7.4 µs 100.0%
cross_agent_taint_laundering 10 10 0 10 ~11.4 µs 100.0%

Summary: Clean-Agent FPR 0.0% · Attack Containment Recall 100.0% · Mean Wire Overhead ~5.9 µs (release build) · LLM-as-a-Judge $0.00


Security & Hardening Highlights

  • Audited Cryptography: Constant-time HMAC-SHA256 (hmac, sha2, subtle) with isolated domain-separated subkeys for X-NetDIFT-Provenance and X-NetDIFT-Declassify, plus fail-closed tamper escalation and single-use jti nonce replay protection.
  • Anti-SSRF & Protocol Smuggling Defenses: Rejects Content-Length + Transfer-Encoding smuggling, duplicate/mismatched Host headers, HTTP method-override headers, MCP JSON-RPC batch-array hiding ([read_file, exec_shell]), and DNS-rebinding/SSRF to loopback, IMDS (169.254.169.254), or private RFC1918 IPs on external origins.
  • Fail-Closed By Construction: Unknown MCP tools, unclassified external origins, saturated tainted session/nonce tables, and malformed/forged provenance headers all fail closed.
  • Hardened Loopback Console & Reports: Authenticated POST /api/declassify (X-NetDIFT-Admin-Token), strict loopback Host DNS-rebinding checks, strict CSP, zero external CDNs, zero innerHTML, and 0600 Unix permissions (with symlink refusal) on exported ECS JSONL and HTML reports.

Development & Verification

cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
cargo test --all-targets

Complementary 3-Layer Defense Suite

NetDIFT completes a 3-project defensive suite targeting hybrid human + agentic threats:

  1. OodaTap (Python — Detection) — Passive encrypted network telemetry engine detecting rogue offensive OODA loops without decrypting TLS.
  2. MirageGate (Go — Active Deception & Attribution) — Zero-LLM L7 edge tarpit & cryptographic human-handoff attribution proxy.
  3. NetDIFT (Rust — Zero-Trust Containment) — Deterministic network-layer Dynamic Information Flow Tracking & monotonic capability attenuation protecting your own internal agents.

Roadmap

  • Pure-Rust Linux eBPF (aya) socket/cgroup enforcement daemon sharing netdift::lattice & netdift::policy
  • Optional TLS MITM / CONNECT inspection mode with explicit enterprise CA pinning for HTTPS egress
  • Persistent SQLite/Redis nonce & session state backend for horizontally scaled multi-node gateways
  • OpenTelemetry (OTLP) span export alongside Elastic Common Schema (ECS v8.11.0) JSONL

Security & License

About

Deterministic network-layer Dynamic Information Flow Tracking (DIFT) and monotonic capability-attenuation gateway for AI agents.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages