CVE-2021-42013 — Apache HTTP Server Path Traversal Vulnerability

CVE-2021-42013

Apache HTTP Server 2.4.49/2.4.50 — Incomplete Patch Bypass for CVE-2021-41773 Enabling Path Traversal and RCE via CGI

What is Apache HTTP Server?

Apache HTTP Server is one of the most widely deployed web servers in the world, powering a significant fraction of internet-accessible websites and internal applications. The 2.4.x branch is the current stable release series. Path traversal vulnerabilities in Apache allow attackers to read files outside the web server's configured document root — and when CGI is enabled, they can achieve remote code execution.

Overview

CVE-2021-42013 is a critical path traversal vulnerability (CWE-22) in Apache HTTP Server 2.4.49 and 2.4.50. The vulnerability is an incomplete fix for CVE-2021-41773 — the patch in Apache 2.4.50 failed to fully address the URL normalization bypass. An attacker can use additional URL encoding patterns (e.g., double-encoding or alternate percent-encoding sequences) to traverse outside the document root and read arbitrary files, or, if CGI scripts are enabled, execute arbitrary OS commands as the web server user. Apache 2.4.51 fully fixes both CVEs. Mass exploitation began the same day CVE-2021-42013 was disclosed.

Affected Versions

Version CVE-2021-41773 CVE-2021-42013 Action
Apache 2.4.48 and earlier Not affected Not affected Upgrade anyway
Apache 2.4.49 Vulnerable Vulnerable Upgrade immediately
Apache 2.4.50 Fixed (incomplete) Vulnerable Upgrade immediately
Apache 2.4.51 Fixed Fixed Safe

Technical Details

Apache HTTP Server 2.4.49 introduced a change in URL normalization that created a path traversal bypass. The 2.4.50 fix addressed some encoding patterns but not all — specifically, additional URL encoding characters (e.g., %%32%65 or .%2e) could still bypass the normalization check:

  • Root cause: Incomplete URL normalization in the path handling code — certain percent-encoded representations of . and / characters were not properly decoded before path traversal checks
  • Exploit patterns: GET /cgi-bin/.%2e/.%2e/.%2e/.%2e/etc/passwd HTTP/1.1 or variations using double-encoding bypass the directory escape check
  • Path traversal: Allows reading any file the web server process has read access to (e.g., /etc/passwd, application configuration files, private keys)
  • RCE condition: Remote code execution requires mod_cgi or mod_cgid to be enabled AND the traversed path to reach a CGI-executable directory
  • Mass exploitation: Attackers scanned for vulnerable Apache 2.4.49/2.4.50 instances starting the day the CVE was published, deploying webshells and cryptominers

Discovery

Security researchers at Ash Daulton and others identified the incomplete fix in Apache 2.4.50 within days of that release. Apache responded with 2.4.51 on October 7 — the same day CVE-2021-42013 was published — demonstrating an exceptionally fast patch turnaround.

Exploitation Context

CVE-2021-42013 (and its predecessor CVE-2021-41773) saw immediate, widespread exploitation. Within 24 hours of public disclosure, internet-scale scanning for Apache 2.4.49 and 2.4.50 servers was underway, with exploitation including file read, webshell deployment, and cryptominer installation. Ransomware operators also incorporated this into their initial access toolkit, given the large number of vulnerable internet-facing Apache servers.

Remediation

  1. Upgrade to Apache HTTP Server 2.4.51 or later immediately — this fully fixes both CVE-2021-41773 and CVE-2021-42013
  2. Verify the Apache version in use: apache2 -v or httpd -v
  3. If CGI is not required, disable mod_cgi and mod_cgid to limit RCE impact even on older versions
  4. Ensure Require all denied is set for directories not intended to be web-accessible — this limits path traversal impact
  5. Review web server access logs for path traversal attempts (/.%2e/, /%%32%65/, /../ patterns)
  6. Check for unexpected files written to the server's CGI directories or document root

Key Details

PropertyValue
CVE ID CVE-2021-42013
Vendor / Product Apache — HTTP Server
NVD Published2021-10-07
NVD Last Modified2025-10-27
CVSS 3.1 Score9.8
CVSS 3.1 VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
SeverityCRITICAL
CWE CWE-22 find similar ↗
CISA KEV Added2021-11-03
CISA KEV Deadline2021-11-17
Known Ransomware Use ⚠️ Yes

CVSS 3.1 Breakdown

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

Required Action

CISA BOD 22-01 Deadline: 2021-11-17. Apply updates per vendor instructions.

Timeline

DateEvent
2021-10-04Apache HTTP Server 2.4.50 released to fix CVE-2021-41773 path traversal
2021-10-07CVE-2021-42013 published — the 2.4.50 fix is found to be incomplete; Apache 2.4.51 released same day
2021-10-07Mass exploitation of both CVE-2021-41773 and CVE-2021-42013 begins on internet-facing servers
2021-11-03Added to CISA Known Exploited Vulnerabilities catalog
2021-11-17CISA BOD 22-01 remediation deadline

References

ResourceType
Apache HTTP Server 2.4 Vulnerabilities Vendor Advisory
NVD — CVE-2021-42013 Vulnerability Database
CISA KEV Catalog Entry US Government