dBPF — a modern-kernel eBPF primitive catalogue
This book is a catalogue of what CAP_BPF plus CAP_PERFMON (or CAP_SYS_ADMIN) actually permits on a modern aarch64 Linux kernel. Every chapter ships with a reproducible POC that runs under a Docker harness, a BEFORE/AFTER line on stdout, and an honest note when the primitive did not fire on the test kernel. Nothing here is a zero-day, an escalation from unprivileged, or a verifier bug. Read Chapter 0: What CAP_BPF Actually Permits first — it pins down the threat model, the non-claims, and how to read the rest of the catalogue.
Start here
- Chapter 20: What We Proved — The Taxonomy: five primitive classes, three motions.
- Chapter 21: Skip Accounting — Primitives That Needed Another Kernel: what didn’t fire and why.
- Chapter 22: The Defender Playbook: inventory, restrict, baseline, audit.
Act I — Foundations
- Chapter 0: What CAP_BPF Actually Permits — threat model, non-claims, and how to read this book.
- Chapter 1: The Mirror Controls —
cap_capableas an observation channel when override-return refuses to fire. - Chapter 2: The OverlayFS Trojan Horse — forging upperdir writes the lowerdir never sees.
- Chapter 3: The FUSE Audit Black-Hole — userspace filesystems as a bypass for in-kernel audit.
- Chapter 4: The Phantom Syscall — tracepoint-driven syscall behaviour without touching the syscall table.
- Chapter 5: Slipping the Cgroup Leash — teaching the kernel to miscount CPU accounting.
5b. Chapter 5b: The Ghost NIC — sock_ops and XDP as a phantom interface invisible to
ip link. - Chapter 6: Silencing SELinux — AVC hook that does not fire on the test kernel (see Chapter 21).
Act II — Kernel Intrusion
- Chapter 7: Device-cgroup Houdini — slipping past device-cgroup allow/deny enforcement.
- Chapter 8: Keyring Heist — reading keyring payloads that were never meant to leave the kernel.
- Chapter 9: PID Namespace Doppelgänger — impersonating PIDs across namespace boundaries.
- Chapter 10: Inode Cloak — the
d_reclenswallow trick for hiding directory entries. - Chapter 11: IRQ Affinity Chaos — steering interrupts away from the cores that would notice.
- Chapter 12: eBPF Signed-Driver Swap — substituting driver behaviour without touching the signed module.
Act III — Total Control
- Chapter 14: SCHED_FIFO Impersonator — claiming realtime priority without the paperwork.
- Chapter 15: NetNS VLAN Ghost — VLAN-tagged exfil across network namespaces.
- Chapter 16: Seccomp TID Hop — escaping a seccomp filter by hopping threads.
- Chapter 18: eBPF Token Bypass — what the token model actually gates and what it does not.
- Chapter 19: What This Book Actually Demonstrated — the closing argument before the autopsy.
Synthesis
- Chapter 20: What We Proved — The Taxonomy — five primitive classes, three motions, cross-referenced to every firing chapter.
- Chapter 21: Skip Accounting — Primitives That Needed Another Kernel — the six primitives that refused to fire, with the kernel-environment reason for each.
- Chapter 22: The Defender Playbook — inventory, restrict, baseline, audit.
The harness
Every claim in this catalogue runs out of dBPF-pocs/harness/proof.py. The harness builds each POC, attaches it, triggers the primitive, and records both the BEFORE/AFTER lines and any verifier refusals or missing hooks. One-command reproduction:
1
2
3
4
docker run --rm -it --privileged --pid=host \
-v /sys:/sys -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf \
-v $PWD/dBPF-pocs:/w -w /w \
dbpf-harness:latest python3 /w/harness/proof.py
Scope
- This book does not document zero-days, privilege escalation without
CAP_BPF, or verifier bugs. Remove the capability from the threat model and every chapter stops working. - Every chapter was reproduced on kernel 6.12.54-linuxkit aarch64 via Docker Desktop on macOS. Other kernels may expose more — see Chapter 21: Skip Accounting — Primitives That Needed Another Kernel for the primitives that did not fire here and the kernel conditions they would need.