AI Environment Guardian & Integrity Shield — Kernel-level supply chain security with eBPF LSM
Project description
AEGIS v1.0 — Kernel-Level Supply Chain Security
AI Environment Guardian & Integrity Shield
AEGIS protects developers and AI coding agents from supply chain attacks (typosquatting, slopsquatting, dependency confusion) using eBPF LSM for kernel-level enforcement that cannot be bypassed from userspace.
Why v1.0? Kernel Enforcement
AEGIS v0.2.x ran entirely in userspace. An adversary (or a compromised LLM) could:
kill -9 aegis— deadpip uninstall aegis-security— gonealias rm='rm'— bypassed
v1.0 moves enforcement to the Linux kernel via eBPF LSM hooks:
| Threat | v0.2.x | v1.0 |
|---|---|---|
pip install evil-pkg (blocklisted) |
Python check | Kernel EPERM (O(1) BPF map) |
kill -9 aegisd |
Process dies | EPERM (task_kill hook) |
rm /usr/local/bin/aegisd |
File deleted | EPERM (inode_unlink hook) |
Agent reads .ssh/ |
Not detected | EPERM (file_open hook) |
| Agent installs unknown package | Python check | Kernel block + async analysis |
Architecture
┌──────────────────── KERNEL SPACE ────────────────────┐
│ eBPF LSM Hooks BPF Maps │
│ ├─ bprm_check_security ├─ blocked_packages│
│ ├─ file_open ├─ allowed_packages│
│ ├─ inode_unlink ├─ agent_pids │
│ └─ task_kill └─ config_map │
└──────────────────────┬───────────────────────────────┘
│ ring buffer
┌──────────────────────▼───────────────────────────────┐
│ aegisd (C++ daemon, CAP_BPF) │
│ ├─ PolicyEngine (YAML → BPF maps) │
│ ├─ TyposquatDetector (Levenshtein + Jaro-Winkler) │
│ ├─ AgentMonitor (/proc scanner) │
│ ├─ HttpClient (PyPI/npm/OSV.dev) │
│ └─ IPC Server (Unix socket) │
└──────────────────────┬───────────────────────────────┘
│ Unix socket
┌──────────────────────▼───────────────────────────────┐
│ aegis CLI (Python, pip install aegis-security) │
│ ├─ Same commands: check, scan, init, status │
│ ├─ New: aegis daemon {start,stop,status,install} │
│ ├─ Hooks: Claude Code, shell, browser │
│ └─ Fallback: works without daemon (v0.2.x mode) │
└──────────────────────────────────────────────────────┘
Quick Start
Install CLI (all platforms)
pip install aegis-security
aegis init
Install Claude Code Hook
aegis hook install claude
# → writes PreToolUse hook to ~/.claude/settings.json
# Claude Code is now protected
Install Kernel Daemon (Linux)
# Build aegisd
cd native && mkdir build && cd build
cmake .. -DAEGIS_ENABLE_BPF=ON
make -j$(nproc)
# Install and start
sudo aegis daemon install
sudo systemctl enable --now aegisd
Verify
# Check daemon status
aegis daemon status
# Test typosquatting detection
aegis check pip install reqeusts
# → BLOCK: possible typosquat of 'requests'
# Test kernel enforcement (with eBPF)
kill -9 $(pidof aegisd)
# → Operation not permitted
rm /usr/local/bin/aegisd
# → Operation not permitted
Features
Typosquatting Detection
Levenshtein distance + Jaro-Winkler similarity against 220+ popular packages across Python, Node.js, and Rust ecosystems.
Slopsquatting / Hallucination Detection
Verifies packages exist in their registry before installation. Blocks AI agent "hallucinated" package names.
AI Agent Awareness
Automatically detects Claude Code, Cursor, Copilot, Aider, and other AI coding agents. Applies stricter thresholds (default-deny for unknown packages from agents).
Vulnerability Scanning
Queries OSV.dev for known CVEs before installation.
Credential Protection (eBPF)
Prevents package install scripts from reading .ssh/, .aws/, .env, .npmrc, .pypirc when running in an agent context.
Self-Protection (eBPF)
- Daemon cannot be killed (except
systemctl stop) - Binary cannot be deleted
- Config cannot be tampered with
Destructive Command Detection
Catches rm -rf /, DROP DATABASE, fork bombs, curl | sh, and 40+ patterns of dangerous shell operations.
Hooks
Claude Code
aegis hook install claude
# Installs PreToolUse hook in ~/.claude/settings.json
Shell
aegis hook install shell
# Source in .bashrc: source ~/.aegis/shell_hook.sh
Browser Extension
aegis hook install browser
# Installs native messaging host for Chrome/Firefox extension
Configuration
~/.aegis/config.yml (or /etc/aegis/config.yml for system daemon):
mode: interactive # interactive / strict / permissive
typosquat_enabled: true
typosquat_threshold: 2 # Levenshtein distance
agent_mode: strict # strict / moderate / permissive
agent_typosquat_threshold: 1
slopsquat_check: true
osv_check: true
ecosystems:
python: { enabled: true }
node: { enabled: true }
rust: { enabled: true }
allowlist: []
blocklist: []
agent_blocklist: []
agent_allowlist: []
Kernel Requirements
| Feature | Minimum | Recommended |
|---|---|---|
| eBPF LSM | Linux 5.7 | Linux 5.15+ |
| BTF | CONFIG_DEBUG_INFO_BTF=y |
Ubuntu 22.04+ |
| LSM | bpf in /sys/kernel/security/lsm |
Add to boot params |
Fallback: If the kernel doesn't support BPF LSM, AEGIS works in pure userspace mode (v0.2.x behavior). No functionality is lost, only kernel enforcement.
Building from Source
C++ Daemon
# Dependencies (Ubuntu/Debian)
sudo apt install cmake g++ pkg-config \
libyaml-cpp-dev libsqlite3-dev libcurl4-openssl-dev
# Without eBPF (userspace-only daemon)
cd native && mkdir build && cd build
cmake .. -DAEGIS_ENABLE_BPF=OFF
make -j$(nproc)
# With eBPF
sudo apt install libbpf-dev libelf-dev zlib1g-dev clang bpftool
cmake .. -DAEGIS_ENABLE_BPF=ON
make -j$(nproc)
Python + Rust
pip install maturin
maturin develop
pip install -e ".[dev]"
pytest
CLI Commands
aegis init Initialize AEGIS
aegis check <cmd> Check a package install command
aegis scan <dir|pkg> Scan for suspicious patterns
aegis status Show AEGIS + daemon status
aegis log View decision history
aegis agent-log View AI agent activity
aegis daemon install Install aegisd + systemd service
aegis daemon start Start daemon
aegis daemon stop Stop daemon
aegis daemon status Detailed daemon status
aegis daemon reload Reload config (SIGHUP)
aegis hook install <target> Install hook (claude/shell/browser)
aegis hook status Show installed hooks
Development
# Prerequisites: Python 3.11+ + Rust toolchain (optional) + C++17 compiler
git clone https://github.com/iafiscal1212/aegis.git
cd aegis
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
# Build Rust extension (optional — pure Python fallback works)
pip install maturin && maturin develop
# Build C++ daemon
cd native && mkdir build && cd build && cmake .. && make -j$(nproc)
# Test
pytest # Python tests
cargo test # Rust tests
cd native/build && ctest # C++ tests
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aegis_security-1.0.0.tar.gz.
File metadata
- Download URL: aegis_security-1.0.0.tar.gz
- Upload date:
- Size: 55.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
399df611affb3f6ccfc0bd8a6e73e1df07d975894c4547c0e0524f3bccf08689
|
|
| MD5 |
50f2cfd74bafa924214c3b1cf36e3171
|
|
| BLAKE2b-256 |
fb5f530c2b24c995e8215e62ba3ea6318db51e8088a27e1b512e9ff3bfe1d5e8
|
File details
Details for the file aegis_security-1.0.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: aegis_security-1.0.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 900.5 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bb90a4a7eefefda8360dfda1e0b9df5dc28a066891004b6b062accb8e9a37da
|
|
| MD5 |
bd53f6cbfcf7881b4230f31d5d43680a
|
|
| BLAKE2b-256 |
52c789d051c0eb553f64b712f69e47dd150e95e3d51b2249ab7b735b9c372b25
|
File details
Details for the file aegis_security-1.0.0-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: aegis_security-1.0.0-cp313-cp313-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2870c629f804da1e4cf2b36c7f5d1591bdd7af2ec101a8622ea7c408601f9554
|
|
| MD5 |
32e6582ab3ee02b660917193e413a0c1
|
|
| BLAKE2b-256 |
02fd758f064803c0a56fe614f78c3474e4ec05415b9934f782e4f8bf823d4ae8
|
File details
Details for the file aegis_security-1.0.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: aegis_security-1.0.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 995.8 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9df5e9199fe298294f2e0b59878747a17d7c5b1441d8219c53a08beb28bd9226
|
|
| MD5 |
7d5bfdc275aa8b143a73610d7c0bd8fc
|
|
| BLAKE2b-256 |
38316807a4f70a8ee4d391b6764fc41e91f034eb5d5b128b902d08028f379b87
|
File details
Details for the file aegis_security-1.0.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: aegis_security-1.0.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 900.5 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9ee33eda047e3be495541bcdf06be6f596bf91ff44c59eafee5dca93b2e9d54
|
|
| MD5 |
570e17cdfe730c30a78cd2f19791d12b
|
|
| BLAKE2b-256 |
316863a5dc892c91b27e916531eae8f9a73c299469459556a9d591d7e44d4b60
|
File details
Details for the file aegis_security-1.0.0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: aegis_security-1.0.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13e766e007d280f993c521529127bfc8fd6e3963da1e1ac92f37c857c466af80
|
|
| MD5 |
245aa123da50e4fb908e5644647e2763
|
|
| BLAKE2b-256 |
010fc74514ed2beb024ddc68ec4d38e5944ce848680b7b7c55cf68f2ed8fb648
|
File details
Details for the file aegis_security-1.0.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: aegis_security-1.0.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 995.6 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8dc48e3afbe343f543dd4122296586994dd8599e7adfdfe4197c61b25c920df
|
|
| MD5 |
eba1bd95aa87dfa479b38ef9a73375a1
|
|
| BLAKE2b-256 |
d0cf280eb4d3a3182ffed14e0aecb3c2ea48dca1fef701c625a631f0c891b4bb
|
File details
Details for the file aegis_security-1.0.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: aegis_security-1.0.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 900.6 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78188e85978b6dc7bbe9c75d04f10264bbbadd3e369fd268496d2b777e9d5809
|
|
| MD5 |
c08ba48e685025a067dd5a29e6753bc0
|
|
| BLAKE2b-256 |
d27bda2f36ec96b9895238eab7e10f7c0225bb9e3956fdacb3f13d1113abe15b
|
File details
Details for the file aegis_security-1.0.0-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: aegis_security-1.0.0-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5599ad13ee51bd3340db3150d18ad86c72fe1d63ed05a190e30e993f69c4f376
|
|
| MD5 |
381fc63277644e0d1893bb29bc6555a7
|
|
| BLAKE2b-256 |
d502a1c8235d2b1035671095c622a282463911298374bde85692e4a2d7905330
|
File details
Details for the file aegis_security-1.0.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: aegis_security-1.0.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 996.0 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf81a4c8cda3d4cd57747e6b32359ba6ed57376f15802b66c69545fea71ad19d
|
|
| MD5 |
d884346eba7180fade273d5eefd7b806
|
|
| BLAKE2b-256 |
af69f049a9b8dc367d959f0efcb9ff182ca30b61f40c661341e04ed00eaafba0
|