CVE-2021-42013

CVE-2021-42013 is a critical-severity vulnerability in Apache Http Server with a CVSS 3.x base score of 9.8. It is listed in CISA's Known Exploited Vulnerabilities (KEV) catalog, confirming it has been exploited in the wild (added 2021-11-03). The underlying weakness is classified as CWE-22.

Key facts

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.

CVE-2021-42013: Apache HTTP Server Path Traversal and Remote Code Execution

AI-generated analysis based on the vulnerability data on this page.

Attribute Value
CVE ID CVE-2021-42013
CWE CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
CVSS v2 7.5 (AV:N/AC:L/Au:N/C:P/I:P/A:P)
CVSS v3.1 9.8 CRITICAL (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)
EPSS 0.99964 (99.976th percentile)
Known Exploited (CISA KEV) Yes — added 2021-11-03
EU Exploited Yes — since 2021-11-03
Published 2021-10-07
Source NVD

Summary

The patch released for CVE-2021-41773 in Apache HTTP Server 2.4.50 was incomplete. Attackers can still perform path traversal using specially crafted URLs to access files outside directories configured by Alias-like directives. If CGI scripting is enabled for these aliased paths, the flaw can be leveraged for remote code execution. Only Apache 2.4.49 and 2.4.50 are affected; earlier versions are not.

Background

In September 2021, CVE-2021-41773 disclosed a path traversal vulnerability in Apache HTTP Server 2.4.49. The Apache team released 2.4.50 as a hotfix, but the validation logic did not fully cover encoded traversal sequences and edge cases in path resolution. Consequently, CVE-2021-42013 was assigned to the incomplete fix, prompting a second emergency patch in 2.4.51.

Root Cause

The vulnerability stems from CWE-22: Path Traversal. The URI normalization and path validation routines in server/util.c and related request-processing modules failed to reject all forms of ../ sequences—especially when combined with URL encoding or double encoding—after the initial fix. When mod_alias or mod_rewrite maps a URL prefix to a filesystem directory, the insufficient sanitization allows the remaining path segments to escape the intended document root or alias target.

Impact

With a CVSS v3.1 score of 9.8 (Critical), the vulnerability is network-exploitable with no authentication, no privileges, and no user interaction required. Successful exploitation can yield:

  • Confidentiality impact: HIGH — arbitrary file read outside configured directories.
  • Integrity impact: HIGH — arbitrary file write or modification if writable paths are reached.
  • Availability impact: HIGH — remote code execution when CGI handlers are mapped to the traversed path.

The EPSS score of 0.99964 and inclusion in the CISA KEV catalog confirm this is one of the most reliably exploited web-server flaws in recent years.

Exploitation Walkthrough (Defensive Perspective)

Ethics caveat: The following description is provided for detection, hardening, and incident-response purposes only. Do not use this knowledge to attack systems without explicit authorization.

An attacker crafts an HTTP request containing encoded traversal sequences in the path, targeting an aliased URI prefix that maps to a local directory. If the server normalizes the path after prefix stripping (or fails to re-check boundary conditions post-normalization), the resulting filesystem path resolves above the alias root. Typical payloads abuse %2e%2e%2f, %2e%2e/, or multiple encoding layers.

When mod_cgi or mod_cgid is configured to execute scripts within the aliased path, the traversal can reach binary executables or writable script directories, turning file read into code execution.

Defensive takeaways:

  • Treat any alias/CGI boundary as a high-risk trust boundary.
  • Normalize and validate paths before prefix matching and again before filesystem access.
  • Disable CGI execution in aliased paths unless strictly required.

Affected and Patched Versions

Status Versions
Affected Apache HTTP Server 2.4.49, 2.4.50
Not affected Apache HTTP Server <= 2.4.48
Patched Apache HTTP Server >= 2.4.51

Third-party distributions (Fedora 34/35, select Oracle products, NetApp Cloud Backup) also shipped affected packages and issued their own updates.

Remediation

  1. Upgrade immediately to Apache HTTP Server 2.4.51 or later.
  2. Compensating controls (if patching is delayed):
    • Add explicit Require all denied directives outside intended alias roots.
    • Disable CGI execution (Options -ExecCGI) on all aliased paths.
    • Deploy a Web Application Firewall (WAF) rule to block paths containing .. sequences, URL-encoded or literal.
    • Restrict ingress to the web server using network-level controls where possible.

Detection

  • Monitor access logs for 404 or 200 responses to URI paths containing %2e, %2f, or double-encoded traversal sequences against aliased endpoints.
  • Correlate with process-spawn events from mod_cgi/mod_cgid executing unexpected binaries.
  • Hunt for outbound connections or post-exploitation behavior from the httpd worker processes.
  • Validate that vulnerability scanners and CMDB records flag Apache 2.4.49–2.4.50 as vulnerable.

Assessment

This CVE represents a textbook example of a patch-gap vulnerability: the initial fix addressed the most obvious attack vector but missed normalization subtleties, giving defenders a false sense of security while attackers continued to exploit the weakened perimeter. The near-perfect EPSS and confirmed active exploitation in the wild (CISA KEV, EU catalog) mean that any unpatched Apache 2.4.49/2.4.50 instance should be assumed compromised until proven otherwise.

Key lessons:

  1. Path normalization must be defense-in-depth, not a single regex or string replacement.
  2. Hotfix releases warrant accelerated regression testing and broader fuzzing, especially for traversal and injection classes.

References

Frequently asked questions

What is CVE-2021-42013?
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.
How severe is CVE-2021-42013?
CVE-2021-42013 has a CVSS 3.x base score of 9.8, rated critical severity. It is exploitable over network with low attack complexity, requires no privileges and no user interaction. Impact on confidentiality is high, integrity high, and availability high.
Is CVE-2021-42013 being actively exploited?
Yes. CVE-2021-42013 is on CISA's Known Exploited Vulnerabilities (KEV) catalog, added on 2021-11-03, which means active exploitation has been confirmed. It should be prioritised for remediation.
What products are affected by CVE-2021-42013?
CVE-2021-42013 primarily affects Apache Http Server. In total, 10 product configurations (CPEs) are listed as vulnerable; see the affected-products list for the exact versions.
How do I fix CVE-2021-42013?
Review the linked vendor and NVD advisories for patched versions and mitigations, then upgrade or apply the recommended workaround. Because this CVE is known to be actively exploited, treat remediation as urgent — CISA KEV typically sets a short remediation deadline.
Does CVE-2021-42013 have an EU (EUVD) identifier?
Yes. CVE-2021-42013 is tracked in the ENISA EU Vulnerability Database (EUVD) as EUVD-2021-29001. It is also flagged as exploited in the EUVD (since 2021-11-03).
When was CVE-2021-42013 published?
CVE-2021-42013 was published on 2021-10-07 and last updated on 2026-06-17.

References

Affected products (10)

More vulnerabilities in Apache Http Server

All CVEs affecting Apache Http Server →

Other CWE-22 (Path Traversal) vulnerabilities

Browse all CWE-22 (Path Traversal) vulnerabilities →