Apache httpd 2.4.50 incomplete traversal fix
Build a lab target running Apache httpd 2.4.50, the version CVE-2021-42013 affects.
- CVSS
- 9.8 / 10
- Vector
- Web app
- Difficulty
- Easy
- Added
- 2026-10-20
About this target
Apache httpd 2.4.50 was the first attempt to fix CVE-2021-41773, and it left a gap: a path that is URL-encoded twice still gets past the check. There are two playbooks for this CVE. One builds 2.4.50 with the root directory opened up as a file-access target. The other builds it with the prefork MPM, mod_cgi loaded and CGI execution allowed on the root directory. Both start the service and stop there.
Remote code execution bugs are the ones defenders care about most. This target is useful for testing detection rules and logging.
- Product
- Apache httpd
- Version
- 2.4.50
- Type
- RCE
- Severity
- Critical
- Port
- 80/tcp
Before you start
This playbook needs the setup from the earlier steps. Check these first.
- The base VM from Step 01 is built and reachable over SSH.
- You cloned the playbooks repo and set
inventory/hosts.iniin Step 02. - A snapshot named
clean-baseexists, and the machine is booted from it.
One CVE at a time. Don't run this on top of another playbook. Reset first.
Run the playbook
Boot the machine from clean-base, then run the playbook for CVE-2021-42013. It installs Apache httpd 2.4.50, sets up its config and starts the service.
ansible-playbook cve/cve-2021-42013.yml
A clean run ends with a recap that shows failed=0. If it fails partway, run it again.
Verify the target
The verify tag checks that the service is listening and running the version this CVE affects. Run it from the host.
ansible-playbook cve/cve-2021-42013.yml --tags verify
You should see target OK.
What defenders can look for
- Requests with doubly encoded dot sequences in the URL path - Access log entries under /cgi-bin/ that resolve to paths outside the web root - Unexpected child processes started by httpd - A Server header or banner showing Apache/2.4.50
How it was fixed
Fixed in Apache httpd 2.4.51, which reworked how encoded path segments are decoded and checked. Upgrade to 2.4.51 or later, and keep the root directory set to Require all denied.
Reset when you're done
Restore clean-base. Nothing from this playbook carries over.
VBoxManage controlvm thehackingmachine acpipowerbutton VBoxManage snapshot thehackingmachine restore clean-base VBoxManage startvm thehackingmachine
References
Credit
Playbook and write-up by TheHackingMachine Team.
Want to add your own? See how to contribute.