Home Library CVE-2021-41773
CVE-2021-41773 High

Apache httpd 2.4.49 path traversal

Build a lab target running Apache httpd 2.4.49, the version CVE-2021-41773 affects.

CVSS
7.5 / 10
Vector
Web app
Difficulty
Easy
Added
2026-10-20
01

About this target

Apache httpd 2.4.49 does not normalise some encoded paths correctly, so a request can reach files outside the web root. The playbook builds 2.4.49 from source with mod_cgi enabled, relaxes the root directory access rule (Require all granted), and starts the service as a systemd unit. Good for practising config review and patch checks.

Web server path bugs are common in real audits. This target is useful for practicing config review and patch checks.

Product
Apache httpd
Version
2.4.49
Type
Traversal
Severity
High
Port
80/tcp
apache cgi web
02

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.ini in Step 02.
  • A snapshot named clean-base exists, and the machine is booted from it.

One CVE at a time. Don't run this on top of another playbook. Reset first.

03

Run the playbook

Boot the machine from clean-base, then run the playbook for CVE-2021-41773. It installs Apache httpd 2.4.49, sets up its config and starts the service.

Terminal · host
ansible-playbook cve/cve-2021-41773.yml 

A clean run ends with a recap that shows failed=0. If it fails partway, run it again.

04

Verify the target

The verify tag checks that the service is listening and running the version this CVE affects. Run it from the host.

Terminal · host
ansible-playbook cve/cve-2021-41773.yml  --tags verify

You should see target OK.

05

What defenders can look for

- Requests to the web server with encoded dot sequences in the URL path - Access log entries under /cgi-bin/ or /icons/ that resolve to paths outside the web root - Unexpected child processes started by httpd - A Server header or banner showing Apache/2.4.49

06

How it was fixed

Fixed in Apache httpd 2.4.50, which tightened path normalisation. That fix was incomplete, see CVE-2021-42013. Upgrade to 2.4.51 or later, and keep the root directory set to Require all denied.

07

Reset when you're done

Restore clean-base. Nothing from this playbook carries over.

Terminal · host
VBoxManage controlvm thehackingmachine acpipowerbutton
VBoxManage snapshot thehackingmachine restore clean-base
VBoxManage startvm thehackingmachine
08

References

09

Credit

Playbook and write-up by TheHackingMachine Team.

Want to add your own? See how to contribute.