Needrestart, prior to version 3.8, contains a vulnerability that allows local attackers to execute arbitrary code with root privileges. This is achieved by manipulating the PYTHONPATH environment variable to trick needrestart into running the Python interpreter in an unsafe context.## Proof of Concept (PoC) for CVE-2024-48990 in `needrestart`
**CVE-2024-48990**: Linux Local Privilege Escalation (LPE) via `needrestart`
- **Patched**: Nov 19, 2024
- **More Information**: [Qualys Advisory](https://www.qualys.com/2024/11/19/needrestart/needrestart.txt)
---
## How to Use?
1. Run the script `./start.sh`.
- This will compile a malicious `importlib` library.
- It will then start a Python script (`e.py`) that sets up a listener and waits for `needrestart` to be executed by the `root` user.
2. When `needrestart` is triggered (typically by an update like `apt upgrade`), it will load the fake library and execute the payload.
3. Upon successful execution, a shell will be opened.
---
[4.0K] /data/pocs/37184c5e0389078f076e56557b83be306d81b18a
├── [ 323] e.py
├── [ 553] lib.c
├── [ 716] README.md
└── [ 241] start.sh
0 directories, 4 files