eBPF Security:
Kernel Observability Risks and Privilege Escalation

eBPF powers modern security tooling — Falco, Cilium, Tetragon, Pixie. But loading eBPF programs requires elevated privileges, verifier bypasses have led to kernel exploits, and malicious eBPF programs make nearly perfect rootkits. Security teams using eBPF defensively must understand its offensive potential.

eBPF Security

eBPF Threat Model

Extended Berkeley Packet Filter (eBPF) allows safe, sandboxed programs to run in the Linux kernel — attaching to system calls, network events, tracepoints, and kernel functions without modifying kernel source code or loading kernel modules. This capability has made eBPF the foundation of cloud-native networking (Cilium), runtime security (Falco, Tetragon), and performance observability (Pixie, Parca).

The same properties that make eBPF valuable for defence make it extraordinarily powerful for offence. An eBPF program running in the kernel can intercept every system call, read process memory, modify network packets, and hide its own activity from user-space monitoring tools — all without the visibility issues that kernel modules traditionally suffer.

Perfect Rootkit Primitive

eBPF programs can hook the syscalls that tools use to detect malicious activity. An eBPF rootkit can hide processes from ps, hide files from ls, hide network connections from netstat, and suppress its own presence in /proc/<pid>/fdinfo — all while the kernel runs it as "safe, verified" code.

Privilege and CAP_BPF

Loading eBPF programs historically required CAP_SYS_ADMIN — near-root privileges. Linux 5.8 introduced CAP_BPF and CAP_PERFMON as more granular capabilities. However, the privilege model remains complex, and many program types still require CAP_SYS_ADMIN.

# eBPF capabilities matrix (simplified)
# CAP_BPF — required for most eBPF program loading
# CAP_NET_ADMIN — required for XDP and TC network programs
# CAP_PERFMON — required for tracing program types
# CAP_SYS_ADMIN — still required for some program types in older kernels

# Check what's needed for a specific program type:
bpftool feature probe

# In Kubernetes: many eBPF security tools require privileged containers
# or elevated capabilities — which means they can also be vectors if compromised
securityContext:
  privileged: true          # Falco legacy install — full node access
  # OR more granular:
  capabilities:
    add: ["BPF", "PERFMON", "NET_ADMIN"]
Privileged DaemonSet Risk

eBPF security tools deployed as privileged DaemonSets represent one of the highest-privilege workloads in a Kubernetes cluster. If a vulnerability in Falco, Tetragon, or a similar tool allows code execution, the attacker gains node-level access on every worker node simultaneously — with eBPF capabilities on top.

Unprivileged eBPF

Some kernels allow unprivileged eBPF (socket filter programs) without any special capabilities. This was historically exploited for privilege escalation and has been disabled by default in most distributions via kernel.unprivileged_bpf_disabled = 1. Verify this sysctl is set in your production nodes.

# Check unprivileged eBPF status
sysctl kernel.unprivileged_bpf_disabled
# Should return: kernel.unprivileged_bpf_disabled = 1

# Set permanently
echo "kernel.unprivileged_bpf_disabled = 1" >> /etc/sysctl.d/99-ebpf.conf
sysctl -p /etc/sysctl.d/99-ebpf.conf

# Kubernetes node hardening — apply via node configuration
# or OS-level hardening profiles (CIS Benchmark Level 1)

Verifier Bypass Exploits

The eBPF verifier is the kernel component that statically analyses loaded programs to ensure they are safe — no unbounded loops, no out-of-bounds memory access, no null pointer dereferences. Verifier bypasses represent some of the most critical kernel vulnerabilities, as they allow execution of arbitrary kernel code under the guise of a "verified" eBPF program.

Notable eBPF Verifier CVEs

  • CVE-2021-3490: Incorrect bounds tracking for bitwise operations — arbitrary kernel read/write. CVSS 7.8.
  • CVE-2021-31440: Off-by-one in bounds tracking for 32-bit pointer arithmetic — privilege escalation.
  • CVE-2022-23222: Speculative execution issue in verifier allowing local privilege escalation. CVSS 7.8.
  • CVE-2023-2163: Incorrect verifier pruning leads to incorrect code generation — arbitrary read/write. CVSS 7.8.
  • CVE-2024-26589: Verifier precision tracking issue — arbitrary kernel code execution from unprivileged context on affected kernels.

Verifier vulnerabilities are particularly dangerous because they are difficult to detect — the attack uses the legitimate eBPF loading interface, passes the verifier's checks, and executes as kernel code. Kernel patching cadence directly affects exposure window.

Malicious eBPF Programs

Once an attacker has the necessary capabilities (from initial exploit, stolen service account, or over-privileged container), eBPF programs can be loaded to achieve persistent stealth. Unlike kernel modules, eBPF programs survive audit easier because they're associated with the "verified" eBPF subsystem and many monitoring tools don't track them.

eBPF Rootkit Attack Flow

1

Attacker gains code execution in a privileged container or on the node

↓
2

Loads eBPF program hooking sys_getdents64 — hides attacker files from directory listings

↓
3

Loads eBPF program hooking sys_read on /proc/net/tcp — hides C2 network connections

↓
4

Loads eBPF XDP program intercepting all network traffic — keylogging, credential harvesting

↓
5

Traditional user-space monitoring tools see nothing. Container runtime reports clean. Node appears healthy.

# Detect loaded eBPF programs on a node
bpftool prog list

# Shows all loaded programs with type, ID, tag, load time
# ID: 42  type: kprobe  name: malicious_hook  tag: abc123...
# Look for unexpected program names or types

# Check eBPF maps (potential data exfil staging areas)
bpftool map list

# Audit eBPF program load events in kernel logs
journalctl -k | grep -i bpf

# Use Tetragon to detect eBPF program loading:
# TracingPolicy watching bpf_prog_load kernel function

Security Tool Supply Chain

The security tools that use eBPF defensively — Falco, Tetragon, Cilium, Pixie — are themselves high-value supply chain targets. A compromised version of Falco running as a privileged DaemonSet with eBPF access doesn't just fail to detect threats; it can actively facilitate them from a position of complete system visibility.

Tool Trust Chain

You're deploying a privileged kernel-level agent to improve security. If that agent is compromised, it has more access to the system than almost any other component. The supply chain integrity of eBPF security tools — Helm chart provenance, image signatures, dependency audits — deserves exceptional scrutiny.

# Verify Falco image signature before deployment
cosign verify \
  --certificate-identity-regexp="https://github.com/falcosecurity/*" \
  --certificate-oidc-issuer="https://token.actions.githubusercontent.com" \
  falcosecurity/falco-no-driver:0.38.0

# Pin Falco image to verified digest in production
image: falcosecurity/falco-no-driver@sha256:verified-digest-here

# Verify Cilium chart integrity
helm install cilium cilium/cilium --version 1.15.0 \
  --set global.rollOutCiliumPods=true
# Always pin to exact versions, never "latest"

Container Escape via eBPF

eBPF programs loaded from within a container can affect the entire host — there is no container namespace isolation for eBPF programs that hook global kernel functions. A container with CAP_BPF (or running privileged) can load eBPF programs that affect all processes on the node, effectively breaking out of the container's isolation boundary.

Namespace Awareness

Some eBPF program types honour network namespaces (socket-level programs). Others operate on the entire host regardless of container boundaries (tracing programs, kprobes, XDP programs). Never grant CAP_BPF or CAP_SYS_ADMIN to untrusted container workloads.

# Kubernetes PodSecurityPolicy / PodSecurity admission
# Prevent containers from loading eBPF programs
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
  name: restricted-no-bpf
spec:
  privileged: false
  allowedCapabilities: []
  requiredDropCapabilities:
    - ALL
  # Dropping ALL capabilities removes CAP_BPF, CAP_SYS_ADMIN, CAP_NET_ADMIN
  # Explicitly document that this prevents eBPF program loading

# With Kubernetes PodSecurity (post-PSP):
# "restricted" profile prevents privileged containers and drops capabilities
# Apply to all namespaces that should not run eBPF tools

Detecting Malicious eBPF

Detecting malicious eBPF usage requires kernel-level visibility — ironically, often provided by another eBPF tool that you trust. Tetragon (the security observability tool from Cilium) can trace eBPF program loading events. The key is establishing a baseline of expected eBPF programs and alerting on deviations.

eBPF Detection Strategies

  • Baseline all expected eBPF programs (bpftool prog list) at deployment time and alert on new unknown programs
  • Monitor bpf() syscall invocations with Tetragon TracingPolicy — alert on programs loaded outside expected security tool namespaces
  • Audit eBPF map creation — unexpected ring buffer or perf buffer maps can indicate data collection
  • Monitor CAP_BPF and CAP_SYS_ADMIN capability grants in container admission — prevent eBPF-capable containers from untrusted workloads
  • Use seccomp profiles to restrict bpf() syscall access for non-security workloads

Hardening eBPF Deployments

eBPF Security Hardening Controls

  • Disable unprivileged eBPF: kernel.unprivileged_bpf_disabled = 1 on all nodes. Verify in CIS benchmark compliance scans.
  • Kernel patching: eBPF verifier vulnerabilities require OS-level patches. Maintain a 30-day patch SLA for kernel CVEs rated High/Critical.
  • Least privilege for eBPF tools: Use CAP_BPF + CAP_PERFMON where sufficient instead of full privileged: true. Scope DaemonSet service accounts to minimum RBAC permissions.
  • Supply chain integrity: Verify image signatures (Cosign) and pin digest hashes for all eBPF security tools. Review Helm chart values for unexpected privilege escalation.
  • eBPF program inventory: Maintain a known-good inventory of eBPF programs. Alert on unrecognised programs at runtime.
  • Seccomp for workloads: Apply seccomp profiles restricting bpf() syscall to containers that don't need it — prevents compromised application containers from loading eBPF programs.
  • Namespace isolation: Run eBPF security tools in dedicated namespaces with strict admission controls, network policies, and audit logging.

"eBPF gives security tools superpower visibility into the kernel. Treat it with the same care you'd treat any superpower — it's exactly as dangerous as it is useful."

eBPF represents the most significant shift in Linux security architecture in a decade. The cloud-native security ecosystem has converged on it as the foundation for runtime threat detection, network policy, and observability. That concentration creates both great capability and a concentrated attack surface: compromising an eBPF-based security tool compromises your ability to detect and respond to everything else.

AquilaX IaC scanning checks Kubernetes and Helm files for risky settings, such as privileged containers.