This proof-of-concept (PoC) exploit targets a privilege escalation vulnerability in CloudPanel environments where the clp user has NOPASSWD sudo access, and FastCGI (PHP-FPM) is misconfigured or exposed locally.
By leveraging insecure FastCGI access and the ability to execute PHP scripts, this exploit executes arbitrary commands as root, either directly or by spawning a privileged root shell.
β οΈ This tool is intended strictly for educational and authorized penetration testing. Do not use it on systems you do not own or have explicit permission to test.
- π§ Run arbitrary system commands as
rootvia PHP-FPM. - π Spawn a pseudo-interactive root shell using a setuid copy of bash.
- π Automatically cleans up temporary files.
- β Minimal dependencies (pure Python3).
The exploit works as follows:
-
A malicious PHP file is written to
/tmp/.cmd.phpcontaining:<?= `sudo sh -c "{cmd}"`; ?>
-
A FastCGI request is sent to a locally exposed PHP-FPM service on
127.0.0.1:{PORT}. -
If the PHP-FPM process runs as a user with
NOPASSWDsudo (e.g.,clp), the command runs as root. -
Optionally, the exploit can:
- Copy
/bin/bashto a temp location. - Set the setuid bit.
- Spawn an interactive shell as UID 0.
- Copy
python3 exploit.py --cmd 'id'python3 exploit.py --interactiveRequires: Python3,
/bin/bash, and a real TTY.
python3 exploit.py --cmd 'cat /etc/shadow'
python3 exploit.py --cmd 'whoami'
python3 exploit.py --interactive| Flag | Description | Default |
|---|---|---|
--host |
Target host address | 127.0.0.1 |
--port |
Target FastCGI port | 8787 |
| File | Description |
|---|---|
exploit.py |
Main exploit script |
/tmp/.cmd.php |
Temporary malicious PHP file (auto-cleaned) |
/tmp/.priv |
Setuid copy of bash (if using --interactive) |
- Python 3.x
- Local access to a system where:
- PHP-FPM is accessible on a local port.
- The FPM process runs as a user with passwordless
sudoaccess. - Writable
/tmpdirectory.
- Jhuanes Septinus (@jnx23)
Inspired by Muhammad Aizat (EagleTube)
This tool is provided for educational and research purposes only.
Do not use this on systems you do not own or have explicit permission to test.
The author is not responsible for any misuse or damage caused.
This project is licensed under the MIT License.