## https://sploitus.com/exploit?id=90EC8998-FB96-54C8-B382-EB8D24257354
# eBPF Verifier Exploit Research β s344024 Romano Simone
Research project for the Security Verification and Testing (SVT) course β
analysis and exploit development for eBPF verifier vulnerabilities in the Linux kernel.
The primary focus is identifying unpatched or unexploited CVEs in `kernel/bpf/verifier.c`,
writing proofs of concept, and developing memory read/write primitives suitable for
Local Privilege Escalation (LPE).
---
## Project Structure
```
s344024_Romano_Simone/
β
βββ test/ β Buildroot-based build & test environment
β βββ build.sh β Interactive build script (CVE + kernel selection)
β βββ buildroot/ β Buildroot source tree
β βββ configs/ β Shared/base buildroot configs
β βββ patches/ β Per-kernel patch sets (linux-4.x ... 5.9.x)
β βββ linux-6.8/kernel/bpf/ β Reference verifier source for diff/analysis
β βββ CVEs/ β One folder per CVE under test
β βββ CVE-2023-39191/
β β βββ configs/ β Per-kernel buildroot + kernel configs
β β β βββ v6.0/
β β β βββ v6.1/
β β βββ exploit_overlay/
β β βββ src/
β βββ CVE-2024-42072/
β β βββ configs/
β β βββ exploit_overlay/
β β βββ src/
β βββ CVE-2024-43838/
β β βββ configs/
β β βββ exploit_overlay/
β β βββ src/
β βββ CVE-2024-45020/
β β βββ configs/
β β βββ exploit_overlay/
β β βββ src/
β βββ CVE-2024-58100/
β βββ configs/
β βββ exploit_overlay/
β βββ src/
β
βββ exploits/ β Standalone exploit sources (outside Buildroot flow)
β βββ CVE-2023-39191/src/ β poc.c, exploit.c
β βββ CVE-2024-42072/src/
β βββ CVE-2024-45020/src/
β βββ CVE-2024-58100/src/
β
βββ report/ β LaTeX report
β βββ main.tex
β βββ compile.sh
β βββ src/ β Per-CVE chapter sources
β β βββ CVE-2023-39191.tex
β β βββ CVE-2024-42072.tex
β β βββ CVE-2024-45020.tex
β β βββ CVE-2024-58100.tex
β βββ img/
β βββ out/ β Build artifacts (aux, log, ...)
β βββ SVT_report.pdf β Compiled PDF
β
βββ presentation/ β LaTeX slides
βββ main.tex
βββ compile.sh
βββ img/
βββ out/
βββ SVT_presentation.pdf β Compiled PDF
```
---
## CVEs
| CVE | Kernel Range | Bug Class | Memory Primitive | LPE Status |
|-----|-------------|-----------|-----------------|------------|
| CVE-2023-39191 | β€ 6.1.19 / β€ 6.2.6 | Dynptr type confusion (OOB via overlapping dynptrs on BPF stack) | Arbitrary OOB R/W via corrupted dynptr size | Full LPE (adaptive calibration + cred spray) |
| CVE-2024-42072 | **Note:** `-m 9216` (9 GiB RAM) is **required** for CVE-2023-39191.
> The exploit's OOB target lands at ~8.2 GiB physical; less RAM makes it unreachable.
| VM Detail | Value |
|-----------|-------|
| Rootfs | Buildroot minimal image |
| Kernel | Per-CVE, selectable in build script |
| Virtualization | QEMU (no KVM required) |
| Login | `root` (no password) |
| BPF | Enabled, unprivileged BPF allowed |
| KASLR / RANDOMIZE_MEMORY | Disabled (for exploit reproducibility) |
| Binary delivery | Via Buildroot overlay β `/root/` in VM |
---
## Building & Running
### CVE-2023-39191 β Dynptr Type Confusion LPE
```bash
# Build Buildroot image for kernel 5.19 (vulnerable)
cd test/
./build.sh # select CVE-2023-39191, kernel v5.19
# Boot VM with 9 GB RAM
cd buildroot/
output/images/start-qemu.sh --serial-only -- -m 9216
# Inside VM:
/root/poc # Verify OOB R/W primitive
/home/user/exploit # Full LPE β creates /tmp/rootsh
/tmp/rootsh # Spawn root shell
```
### CVE-2024-42072
```bash
cd test/
./build.sh # select CVE-2024-42072
cd buildroot/
output/images/start-qemu.sh --serial-only
# Inside VM:
/root/poc # OOB read primitive demo
/root/exploit # Exploitation attempt
```
### CVE-2024-45020
```bash
cd test/
./build.sh # select CVE-2024-45020
cd buildroot/
output/images/start-qemu.sh --serial-only
# Inside VM:
/root/poc # Dynptr OOB trigger
/root/exploit # Exploitation attempt
```
### CVE-2024-58100 β Stale PTR_TO_PACKET UAF
```bash
cd test/
./build.sh # select CVE-2024-58100, kernel v6.12.24
cd buildroot/
output/images/start-qemu.sh -- -smp 4
# Inside VM (login as user, uid=1000):
/home/user/poc # Verifier-accept demo (stale PTR_TO_PACKET load)
/home/user/exploit # UAF R/W primitive + PE attempt via pipe_buffer.ops
```
> **Capabilities:** the init script (`exploit_overlay/etc/init.d/S99exploit`) grants
> `cap_bpf,cap_net_admin,cap_perfmon,cap_syslog+ep` to the exploit binary and sets
> `kptr_restrict=0`, `unprivileged_bpf_disabled=0`, `perf_event_paranoid=0`. This
> simulates a context where a service with BPF policy is compromised β CVE-2024-58100
> is **not** exploitable by a fully unprivileged user on modern kernels.
---
## Report
The full technical report (LaTeX + PDF) is in `report/`. It covers:
- Methodology for CVE selection from the eBPF verifier bug class
- Technical analysis of each CVE (patch diff, root cause, exploitation path)
- Exploit design decisions and failed approaches
- Results and conclusions
Politecnico di Torino β Cybersecurity (SVT) β A.Y. 2025/2026