
Audit only eBPF EDR for Linux 5.15+ LTS: 14 kernel hooks, 15 actions (13 MITRE techniques), process lineage, SIEM export, K8s/Docker ready.
Audit only eBPF runtime sensor for Linux - container escape detection, hardened by design.
19 detection actions · 24 BPF programs · BPF-LSM resolved-path rules · IPv6 · wire format v4
Support the project:
[!IMPORTANT] Detection & audit only non enforcing. No BPF program returns
-EPERM; no syscall is ever blocked. This is a runtime observation plane, not a prevention plane. Seedocs/SECURITY.mdandTHREAT_MODEL.md.
| 🎯 Canary files | Plant invisible paths in a kernel O(1) map - any touch fires a CRITICAL alert instantly, including openat2 and probes of nonexistent files |
| 🛡️ Evasion-resistant | openat2 hooked · unshare(CLONE_NEWUSER) escalates to CRITICAL · self-exclusion is PID-based (unspoofable via prctl) · release_agent matched anywhere under /sys/fs/cgroup/ |
| 🧠 BPF LSM mode | On kernels with bpf in the active LSM list, lsm/file_open classifies kernel-resolved paths (bpf_d_path) - io_uring opens and user-string races closed in one step; falls back to tracepoints automatically |
| 🌐 Full-stack network vision | IPv4 and IPv6 connects with configurable suspicious-port severity |
| 📈 Observability built-in | Hand-rolled Prometheus /metrics (zero deps), Sensor_Heartbeat synthetic alerts for SIEM silence detection, degraded/last_err health fields |
| 🏥 Self-healing | systemd Type=notify + WatchdogSec=30 and K8s liveness probes on a 10s heartbeat - a hung sensor restarts itself (verified live with SIGSTOP) |
| 🔐 Least-privilege deployment | privileged: false + CAP_BPF/PERFMON/SYS_ADMIN only, seccomp RuntimeDefault, Secrets for SIEM tokens, system-node-critical priority |
| ⚡ Fast and small | ~0.7% idle CPU, 0 ring-buffer drops at 25,000 forks, 33–43 MB RSS, zero-dependency Go daemon |
| 📤 SIEM-native | JSON · ECS 8.11 · OCSF 1.3.0 · CEF · LEEF 2.0 → file/stdout/syslog/HTTPS-webhook (Splunk HEC) with batching, retry and circuit breaker |
git clone https://github.com/0xmfbk/ebpf-container-escape-framework.git
cd ebpf-container-escape-framework
make check-env # read-only probe: toolchain, BTF, tracefs, LSM, systemd
sudo make deps # one-shot bootstrap: clang, libbpf, bpftool, Go 1.26+
make kernel userspace emulation
sudo -E make verify # full suite: 104 checks (97 core + 7 SIEM) on Debian/6.12
sudo ./install.sh # systemd service (hardened unit, config preserved)
Requirements: kernel ≥ 5.15 with CONFIG_DEBUG_INFO_BTF (/sys/kernel/btf/vmlinux), root with CAP_BPF CAP_PERFMON CAP_SYS_ADMIN. make deps/make check-env work on Debian, Ubuntu and WSL2 (docs/WSL2.md).
| # | Action | Severity | MITRE | Hook |
|---|---|---|---|---|
| 1 | Container_Namespace_Unshare | T1611 | kprobe __x64_sys_unshare - CLONE_NEWUSER escalates to | |
| 2 | Container_Pivot_Root_Escape | T1611 | kprobe __x64_sys_pivot_root | |
| 3 | Sensitive_File_Access | T1003.008 | /etc/shadow · runtime sockets (docker/containerd/crio/k3s) | |
| 4 | Process_Execution | T1059.004 | sys_enter_execve | |
| 5 | Network_Connection | T1071 | sys_enter_connect - IPv4 + IPv6, configurable suspicious ports | |
| 6 | Process_Injection | T1055.008 | sys_enter_ptrace | |
| 7 | Log_Tampering | T1562.001 | unlinkat · truncate · rename/renameat/renameat2 · write-intent opens (O_TRUNC/O_WRONLY) | |
| 8 | Ebpf_Tampering | T1562.001 | sys_enter_bpf (load/attach/link cmds) | |
| 9 | Perf_Event_Open | T1562.001 | sys_enter_perf_event_open (suppressed by default) | |
| 10 | Suspicious_Mount | T1611 | sys_enter_mount | |
| 11 | Namespace_Switch | T1611 | sys_enter_setns | |
| 12 | Chroot_Escape | T1611 | sys_enter_chroot | |
| 13 | Executable_Memory | T1620 | sys_enter_mprotect (PROT_EXEC) (suppressed by default) | |
| 14 | Core_Pattern_Modification | T1611 | core_pattern · modprobe · uevent_helper | |
| 15 | Cgroup_Release_Agent | T1611 | any release_agent/notify_on_release under /sys/fs/cgroup/ | |
| 16 | Canary_Triggered | T1552.001 | canary map hit - fires even for nonexistent paths | |
| 17 | Memfd_Create | T1055.012 | sys_enter_memfd_create - fileless payloads | |
| 18 | Execveat | T1620 | sys_enter_execveat - fd/memfd execution | |
| 19 | Kernel_Module_Load | T1547.006 | sys_enter_init_module + finit_module |
Two detection classes for the file path rules (actions 3, 14, 15, 16):