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

Goal: 1000 CNY · Raised: 1359 CNY

100%

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
PoC for CVE-2024-48990
Readme
# PoC for CVE-2024-48990

CVE-2024-48990 is a local privilege escalation vulnerability found in the `needrestart` utility. The vuln exists in versions prior to 3.8. The service, which runs as root during events like package installations, insecurely scans all running processes. When it finds a Python process, it reads and trusts the PYTHONPATH environment variable from that process.

An unprivileged local attacker can hijack the PYTHONPATH on a "lure" process. When `needrestart` runs, it will find it, adopting the malicious path, and then execute the attacker's code with root privileges.

## Usage
1. Clone the repository in an attacker controlled directory:
```
git clone https://github.com/Mr-DJ/CVE-2024-48990
cd CVE-2024-48990
```

2. Make the exploit script executable:
```
chmod +x exploit.sh
```

3. Run the exploit. It will set the trap and wait till the SUID shell is detected(created when `needrestart` is executed by root), popping a root shell.


## Mitigation
- Patch: Update `needrestart` to version 3.8 or a patched version from your distribution
- Harden Mounts: This exploit can also be mitigated by mounting user writable directories with the `nosuid` and `noexec` options.

## References
- CVE: [https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-48990](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-48990)
- Original Advisory: [Qualys - LPEs in needrestart](https://www.qualys.com/2024/11/19/needrestart/needrestart.txt)

- NIST: [NVD-CVE-2024-48990](https://nvd.nist.gov/vuln/detail/CVE-2024-48990)
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
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 →