1. October 2021: The Path Traversal in the World's Oldest Web Server
In early October 2021, the Apache HTTP Server Project released version 2.4.50 to fix an actively exploited zero-day vulnerability in its path normalization logic: CVE-2021-41773. Within 48 hours, security researchers discovered that the patch was incomplete, creating CVE-2021-42013 and enabling unauthenticated remote code execution on misconfigured servers running CGI modules.
2. CVE Metadata Overview
| CVE ID | CVSS | Vulnerability Class | Affected Apache Versions | Patched In |
|---|---|---|---|---|
| CVE-2021-41773 | 7.5 | Path Normalization Directory Traversal & Arbitrary File Read | Apache HTTP Server 2.4.49 | 2.4.50 |
| CVE-2021-42013 | 9.8 | Incomplete Patch / Remote Code Execution via CGI | Apache HTTP Server 2.4.49 & 2.4.50 | 2.4.51 |
3. Technical Root Cause: The URL Normalization Flaw
Apache 2.4.49 introduced a new path normalization function (ap_normalize_path) intended to clean URL paths by resolving directory traversal tokens (../).
The parser checked for the presence of ../, but it performed URL-decoding after the safety check was completed. By sending double-encoded or percentage-encoded dots (.%2e/ or %%32%65%%32%65/), attackers bypassed the string comparison:
GET /icons/.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd HTTP/1.1
Host: web.enterprise-store.com
If the Apache configuration did not explicitly enforce Require all denied on the root filesystem (<Directory />), Apache read and returned files located outside the designated web root.
4. Escalation to Remote Code Execution
When mod_cgi or mod_cgid was enabled, attackers could traverse into executable directories (such as /bin/sh) and execute arbitrary shell commands via standard POST requests:
POST /cgi-bin/.%%32%65/.%%32%65/.%%32%65/.%%32%65/bin/sh HTTP/1.1
Host: web.enterprise-store.com
Content-Type: text/plain
echo Content-Type: text/plain; echo; /usr/bin/id
5. Detection and Server Configuration Fixes
# Search Apache access logs for traversal attempts
grep -E '(.%2e|%%32%65)' /var/log/apache2/access.log /var/log/httpd/access_log
6. Mandatory Hardening Blueprint
- Upgrade immediately to Apache HTTP Server 2.4.51 or later.
- Ensure your
httpd.confenforces default directory access denial:<Directory /> AllowOverride none Require all denied </Directory> - Disable unnecessary legacy CGI modules (
mod_cgi,mod_cgid) in favor of modern FastCGI / PHP-FPM architectures.
Suggested & Related Reading
Explore related engineering guides from Kenneth D'Silva:
-
Laravel Ignition RCE (CVE-2021-3129): Exploiting PHP Debug Pages in Production
A technical examination of Laravel Ignition remote code execution (CVE-2021-3129), PHP Phar ...
-
TeamCity Auth Bypass & RCE (CVE-2023-42793 & CVE-2024-27198)
A technical examination of JetBrains TeamCity authentication bypass vulnerabilities (CVE-202...
-
Juniper Junos OS J-Web RCE Chain (CVE-2023-36844 to 36847): PHP Environment Injection
A technical post-mortem of Juniper Junos OS J-Web vulnerability chains (CVE-2023-36844, 3684...
-
OpenSSL CVE-2022-3602 & CVE-2022-3786: The Vulnerability That Wasn't Heartbleed 2.0
Technical post-mortem on OpenSSL CVE-2022-3602 and CVE-2022-3786, X.509 email address punyco...
-
Top Critical CVEs of 2024–2025: Web Apps, Infrastructure & Cloud
A technical compendium of the most exploited critical CVEs across web applications, cloud in...