Sploitus

Exploit for Use After Free in Linux Linux Kernel

githubexploit Β· 2026-08-20

Exploit Code

README98 lines
## https://sploitus.com/exploit?id=16F30584-5BA9-5884-B6BF-DCD9A0D518DE
# CVE-2026-46242 β€” "Bad Epoll"

This repo is a bad Epoll validator for aarch64 kernels based on exploit already exists for x86.

> **Linux Kernel Local Privilege Escalation via `epoll` Use-After-Free Race Condition**

| Field | Detail |
|---|---|
| **CVE** | CVE-2026-46242 |
| **Nickname** | Bad Epoll |
| **Type** | Use-After-Free (UAF) via race condition |
| **CVSS** | 7.8 (High) |
| **Impact** | Local Privilege Escalation β†’ root |
| **Affected kernels** | 5.10 – 6.11 (LTS & COS) |
| **Subsystem** | `fs/eventpoll.c` (`ep_remove()` / close path) |

---

## Vulnerability Summary

A race condition exists in the Linux kernel's `epoll` subsystem during concurrent `close()` operations on monitored and monitoring file descriptors.  When two close paths execute simultaneously:

1. One path frees an `eventpoll` object via `ep_remove()`.
2. The other path's pending `hlist_del_rcu()` write lands on the **already-freed** memory.

This produces a **Use-After-Free** that corrupts the `refs` list of the reclaimed `eventpoll`, leaving a **dangling `epi->ffd.file`** pointer in the surviving epoll waiter β€” the foundation for the full exploit chain.

---


## Exploitation Flow

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. KASLR Leak       (prefetch side-channel via libxdk)  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 2. Race Trigger      (close-vs-close UAF on eventpoll)  β”‚
β”‚    β”œβ”€ Adaptive timer: stat/exec phases calibrate ahead  β”‚
β”‚    β”œβ”€ False-sharing:  dup()+close() widens race window  β”‚
β”‚    └─ Oracle:         EPOLL_CTL_ADD depth-3 β†’ ELOOP?    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 3. Reclaim           (freed eventpoll β†’ ep_uaf_target)  β”‚
β”‚    └─ Dangling epi->ffd.file in ep_uaf_waiter           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 4. Cross-Cache       (filp slab β†’ buddy β†’ pipe_buffer)  β”‚
β”‚    β”œβ”€ Drain per-CPU partial list                        β”‚
β”‚    β”œβ”€ Free enclosing objects β†’ slab page freed          β”‚
β”‚    └─ Reclaim as pipe pages (256 Γ— 4 KiB)              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 5. Constrained AAR   (fdinfo ino:/sdev: as read oracle) β”‚
β”‚    β”œβ”€ Fake file spray tiles forged struct file in pipe  β”‚
β”‚    β”œβ”€ 8B read: ino: ← i_ino at controlled offset       β”‚
β”‚    β”œβ”€ 4B read: sdev: ← sigaltstack(sas_ss_sp) cursor   β”‚
β”‚    └─ Walk: init_task β†’ find exploit task β†’ resolve     β”‚
β”‚       files β†’ fdt β†’ fd[] β†’ pipe_buffer β†’ struct page   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
│ 6. RIP Control       (f_op→poll hijack → JOP → ROP)    │
β”‚    β”œβ”€ Forge f_op = virt, f_count = virt - 1             β”‚
β”‚    β”œβ”€ JOP pivot chain lands rsp on controlled page      β”‚
β”‚    └─ libxdk ROP: commit_creds(init_cred) + ns switch  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 7. Ret2Usr           execve("/bin/bash") as root        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

### Build

```bash
# aarch64 (cross-compile or native)
aarch64-linux-gnu-gcc -O2 -Wall -pthread -march=armv8-a \
    race_check_aarch64.c -o race_check
```

### Usage

```bash
./race_check [timeout_seconds]   # default: 300s (5 min)
./race_check 120                 # 2-minute timeout
```

### Exit Codes

| Code | Meaning |
|---|---|
| `0` | Race won β€” kernel is vulnerable |
| `1` | Timeout β€” race not detected (possible false negative, does **not** prove the kernel is patched) |

---

## References

- [Original PoC (J-jaeyoung)](https://github.com/J-jaeyoung/security-research/blob/submit-cve-2026-46242/pocs/linux/kernelctf/CVE-2026-46242_lts_cos/exploit/lts-6.12.67/exploit.cpp)
- [NVD β€” CVE-2026-46242](https://nvd.nist.gov/vuln/detail/CVE-2026-46242)

---

> **⚠️ Disclaimer:** This repository is provided for **educational and authorized security research purposes only**. Unauthorized use of this exploit against systems you do not own or have explicit permission to test is illegal.