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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-42013 PoC — Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773)

Source
Associated Vulnerability
Title:Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) (CVE-2021-42013)
Description:It was found that the fix for CVE-2021-41773 in Apache HTTP Server 2.4.50 was insufficient. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives. If files outside of these directories are not protected by the usual default configuration "require all denied", these requests can succeed. If CGI scripts are also enabled for these aliased pathes, this could allow for remote code execution. This issue only affects Apache 2.4.49 and Apache 2.4.50 and not earlier versions.
Description
cve-2021-42013.py is a python script that will help in finding Path Traversal or Remote Code Execution vulnerability in Apache 2.4.50
Readme
# Apache 2.4.50 - Path Traversal or Remote Code Execution
CVE-2021-42013.py is a python script that will help in finding Path Traversal or Remote Code Execution vulnerability in [Apache 2.4.50](https://archive.apache.org/dist/httpd/httpd-2.4.50.tar.gz). Vulnerable instance of Docker is provided to get your hands dirty on [CVE-2021-42013](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-42013)

If CGI-BIN is enabled than, we can perform Remote Code Execution but not Path Traversal, so "icons" directory has been added under Alias section in httpd.conf for checking Path Traversal vulnerability.

# Vulnerable Configurations in httpd.conf
```
1. Enable CGI-BIN
2. Add "icons" directory in Alias section
3. <Directory>Require all granted</Directory>
```

# Lab for CVE-2021-42013
### Build Docker
```
$ docker build -t cve-2021-42013 .
```
### Run Docker
```
$ docker run -it cve-2021-42013
```

# Usage cve-2021-42013.py
### Check for Path Traversal and Remote Code Execution
```
$ python3 cve-2021-42013.py -u http://172.17.0.2
```

### Path Traversal PoC
```
$ python3 cve-2021-42013.py -u http://172.17.0.2 -pt
```

### Remote Code Execution PoC
```
$ python3 cve-2021-42013.py -u http://172.17.0.2 -rce
```

### For bulk scanning, provide a text file containing IPs:
```
$ python3 cve-2021-42013.py -l list.txt
```
```
$ python3 cve-2021-42013.py -l list.txt -pt
```
```
$ python3 cve-2021-42013.py -l list.txt -rce
```

More information can be found [here](https://walnutsecurity.com/path-traversal-remote-code-execution-in-apache/).

### References
* https://nvd.nist.gov/vuln/detail/CVE-2021-42013
* https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-42013
* https://www.cve.org/CVERecord?id=CVE-2021-42013
* https://httpd.apache.org/security/vulnerabilities_24.html
* https://walnutsecurity.com/path-traversal-remote-code-execution-in-apache/
File Snapshot

[4.0K] /data/pocs/836f0f0391222aba0dfb4fee4c136f4e7a2bfde3 ├── [5.6K] cve-2021-42013.py ├── [ 416] Dockerfile ├── [ 18K] httpd.conf └── [1.8K] README.md 0 directories, 4 files
Shenlong Bot has cached this for you
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 →