## https://sploitus.com/exploit?id=05A924D8-6752-5085-A17B-85A9635984FD
# CVE-2021-42013-PoC
A lightweight, interactive Bash utility designed to audit and verify vulnerability to **CVE-2021-42013** (Apache HTTP Server 2.4.49 / 2.4.50 Path Traversal and Remote Code Execution).
This script automates the generation of double-URL-encoded payloads to help security administrators verify whether their infrastructure is properly locked down.
---
## ๐ Disclaimer
> **IMPORTANT:** This tool is intended strictly for authorized security auditing, penetration testing, and educational purposes. Running this tool against targets without prior written consent is illegal. The author assumes no liability for misuse or damage caused by this software.
---
## ๐ ๏ธ Vulnerability Overview
**CVE-2021-42013** occurs due to an incomplete fix for CVE-2021-41773 in Apache HTTP Server 2.4.50. Attackers can use double URL encoding (`%%32%65` or `%252e`) to bypass path traversal restrictions. If the `mod_cgi` or `mod_cgid` modules are enabled and directory permissions are misconfigured, this flaw can escalate from arbitrary file read to **Remote Code Execution (RCE)**.
---
## ๐ Features
- ๐จ **Interactive CLI:** Built-in shell-like environment for immediate command evaluation.
- โก **Lightweight:** Pure Bash implementation relying only on standard binaries (`curl`).
- ๐๏ธ **Target Flexibility:** Customizable target URL and CGI directory paths.
---
## ๐ Prerequisites
The script requires standard Linux/Unix utilities:
- `bash`
- `curl`
---
## ๐ป Usage
1. **Clone the repository:**
```bash
git clone https://github.com/Mode000/APACHE-2.4.49-2.4.50-exploit.git
cd APACHE-2.4.49-2.4.50-exploit
```
2. **Grant execution permissions:**
```bash
chmod +x apacherce2.sh
```
3. **Run the script:**
```bash
./apacherce2.sh
```
### Example
```bash
./apacherce2.sh http://192.168.1.50:8080 /cgi-bin/
```
---
## ๐ก๏ธ Remediation & Defense
To mitigate this vulnerability on your network:
1. **Update Apache:** Upgrade immediately to Apache HTTP Server version **2.4.51 or higher**.
2. **Restrict Access:** Ensure strict directory permissions are explicitly configured in your `httpd.conf`:
```apache
AllowOverride none
Require all denied
```
3. **Disable CGI:** If not strictly necessary, disable `mod_cgi` and `mod_cgid`.