AegisBPF: A Linux Runtime Security Agent Guarding the Kernel via eBPF and LSMArticle · digest for October 15
Cutaway diagram of the Linux kernel architecture with preventive system call interception by AegisBPF via eBPF LSM
Article5 sections≈ 4 min

AegisBPF: A Linux Runtime Security Agent Guarding the Kernel via eBPF and LSM

Think about how Linux security usually works. You install Falco or classic auditd, collect terabytes of syscall logs, and wire up alerts to Telegram. Then an attacker runs a malicious script in a fraction of a second, dumps your databases, and wipes their tracks. Half an hour later, you get a neat alert telling you the server was successfully compromised.

Developer Eren Ari proposed a fundamentally different approach in the open-source project AegisBPF. Instead of passive observation in user space, the agent runs directly inside the Linux kernel via the Linux Security Modules (LSM) subsystem and eBPF, blocking suspicious actions before they finish.

Two Philosophies: Detection vs. Preventive Interception

Traditional HIDS tools rely on detection. A process makes a system call, the kernel executes it, and a copy of the event goes to an audit daemon. If the daemon stalls or the event ring buffer overflows, the attack slips through unnoticed.

AegisBPF follows an Enforcement-First model. Its eBPF programs attach directly to 15 kernel LSM hooks:

  • File operations: file_open, inode_permission, inode_copy_up, and bprm_check_security.
  • Network sockets: the full connection lifecycle from socket_connect and socket_bind to socket_sendmsg and socket_recvmsg.

When an unauthorized binary tries to open a protected file or initiate an outbound TCP connection, the LSM hook synchronously returns -EPERM. The call is terminated inside the kernel before ever reaching the disk or network interface.

Protection Against Container Escapes and Path Spoofing

In Kubernetes environments, attackers often exploit OverlayFS flaws by swapping symlinks (TOCTOU attacks) or modifying lower-layer files.

AegisBPF handles this cleanly in two ways:

  1. Copy-up interception: The inode_copy_up hook catches the exact moment a file from a container's read-only lower layer is promoted to the writable upper layer, automatically transferring the block rule to the new inode number.
  2. IMA hash verification: On kernels 6.1+, bpf_ima_file_hash() checks the cryptographic SHA-256 hash of an executable during bprm_check_security. Even if malware is renamed to /usr/bin/python, execution is blocked immediately.
Linux Kernel Requirements

AegisBPF requires Linux kernel 5.8+ with BPF LSM enabled (CONFIG_BPF_LSM=y). You can check the subsystem status on your server with cat /sys/kernel/security/lsm | grep bpf.

The Cost: Overhead Benchmarks

Every sysadmin's biggest fear about security tools is that they will tank production performance. AegisBPF keeps overhead remarkably low:

  • File benchmarks show 1.68 µs per operation, compared to 1.69 µs on a clean system without the agent, which is within statistical noise.
  • Network overhead is only +6.9% when monitoring all six socket lifecycle phases.

By comparison, traditional tools that copy every syscall context to user space via ring buffers can add 30–40% overhead under heavy I/O.

In Practice: Launch and Declarative Policies

The agent is managed through a CLI utility written in C++20:

# Start the agent in preventive enforcement mode sending SIGTERM to offending processes
sudo aegisbpf run --enforce --enforce-signal=term

# Enable escalation to SIGKILL on repeated violation attempts
sudo aegisbpf run --enforce --enforce-signal=kill \
  --kill-escalation-threshold=8 \
  --kill-escalation-window-seconds=60

# Block a suspicious file immediately without restarting
sudo aegisbpf block add /usr/bin/xmrig

Security rules live in /etc/aegisbpf/policy.conf:

version=6

# Deny execution by file path
[deny_path]
/usr/bin/xmrig
/tmp/miner.sh

# Deny access by inode number (resistant to renaming)
[deny_inode]
259:12345

# Trusted cgroups v2 groups
[allow_cgroup]
/sys/fs/cgroup/system.slice

# Block network connections for an isolated container
[cgroup_deny_port]
cgid:123456 443:tcp:egress

# Allow execution only for binaries with a trusted SHA-256 hash
[allow_binary_hash]
sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

Policies are applied atomically with sudo aegisbpf policy apply /etc/aegisbpf/policy.conf.

Project Outlook

The project is still young—active development began in 2026—and the author notes that an independent external code audit is planned closer to the 1.0 GA release. Still, the direction is clear: the era of post-mortem logging is fading, and the future of Linux infrastructure defense belongs to preventive filtering at the kernel hook level.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 2