Share
## 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