critical CVSS 9.5 Actively exploited EPSS 100%

CVE-2021-40438·Apache vulnerability

A crafted request uri-path can cause mod_proxy to forward the request to an origin server choosen by the remote user. This issue affects Apache HTTP Server 2.4.48 and earlier.

Severity
critical
Software
Apache
Fixed in
2.4.49-1
Published

How likely is exploitation

FIRST's Exploit Prediction Scoring System puts the probability of this CVE being exploited in the next 30 days at 100% — among the highest-scoring CVEs ever published. EPSS is an independent forecast of exploitation, not a severity rating: it says nothing about how much damage a successful attack does, which is what a CVSS score measures.

Affected versions

Until: 2.4.49-1

Fixed in: 2.4.49-1

How to fix this CVE

Upgrade Apache HTTP Server to version 2.4.49-1 or later to patch the mod_proxy request routing vulnerability. This critical flaw allows attackers to manipulate URI paths and redirect traffic to arbitrary origin servers under their control. Organizations using Apache 2.4.48 or earlier with mod_proxy enabled should prioritize this update immediately, as active exploitation has been documented.

sudo dnf update httpd

Defensia detects this vulnerability

What an exploitation attempt looks like

Sample log line indicative of exploitation attempts:

GET|POST|CONNECT .*(\.\.%2f|\.\.%5c|://[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|ProxyPassReverse|X-Forwarded-Host:.*[0-9]{1,3}\.[0-9]{1,3}) HTTP

WAF mitigation (if patching is not yet possible)

Add this rule to your WAF to block exploitation attempts while you schedule the patch.

Configure ModSecurity or other WAF to block requests containing path traversal sequences (../ or encoded variants) and requests with X-Forwarded-Host headers pointing to RFC1918 or non-whitelisted external IP ranges. Implement strict validation on URI paths before they reach mod_proxy handlers. Additionally, restrict ProxyPass directives to explicitly defined destination hosts only and reject any dynamic host resolution.

How to check if you are affected

  1. Step 1: Check your Apache version by running: apache2ctl -v or httpd -v — confirm if version is 2.4.48 or earlier
  2. Step 2: Verify mod_proxy is loaded by running: apache2ctl -M | grep proxy or httpd -M | grep proxy — if output shows 'proxy_module' or 'proxy_http_module', the attack surface is active
  3. Step 3: Review Apache access logs for suspicious URI patterns containing encoded or double-encoded path segments targeting external IPs: grep -E '\.\.%|%2e%2e|://[0-9]{1,3}\.[0-9]{1,3}' /var/log/apache2/access.log*
  4. Step 4: Verify the patch by running: apache2ctl -v or httpd -v again after upgrading and confirm version is 2.4.49-1 or higher

FAQ

What is CVE-2021-40438?

CVE-2021-40438 is a critical request routing vulnerability in Apache's mod_proxy module that allows remote attackers to craft malicious URI paths which redirect server-to-server requests to attacker-controlled destination servers, bypassing intended access controls.

Is CVE-2021-40438 being actively exploited?

Yes, CVE-2021-40438 is listed in the CISA KEV catalog, indicating active exploitation in the wild. Threat actors are leveraging this vulnerability to perform request smuggling and server-side request forgery (SSRF) attacks.

What versions of Apache are affected by CVE-2021-40438?

Apache HTTP Server version 2.4.48 and all earlier versions are vulnerable. The vulnerability was patched in version 2.4.49-1.

How do I check if my server is vulnerable to CVE-2021-40438?

Run 'apache2ctl -v' or 'httpd -v' to check your version. If it reports 2.4.48 or earlier AND mod_proxy is enabled (confirmed via 'apache2ctl -M | grep proxy'), your server is vulnerable.

Does Defensia detect CVE-2021-40438?

Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Apache is installed on a monitored server, CVE-2021-40438 will appear in your dashboard with remediation steps.

Related Apache CVEs

CVE-2026-29167CVSS 10Use After Free vulnerability in Apache HTTP Server with mod_ldap in per-directory configuration This issue affects Apache HTTP Server: from 2.4.0 through 2.4.67. Users are recommended to upgrade to version 2.4.68, which fixes the issue.
CVE-2021-41773CVSS 10A flaw was found in a change made to path normalization in Apache HTTP Server 2.4.49. 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 is known to be exploited in the wild. This issue only affects Apache 2.4.49 and not earlier versions. The fix in Apache HTTP Server 2.4.50 was found to be incomplete, see CVE-2021-42013.
CVE-2026-44631CVSS 10Buffer Underwrite vulnerability in Apache HTTP Server on crafted regular expressions in the configuration. This issue affects Apache HTTP Server: from 2.4.0 through 2.4.67. Users are recommended to upgrade to version 2.4.68, which fixes the issue.
CVE-2021-42013CVSS 10It 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-44790CVSS 10A carefully crafted request body can cause a buffer overflow in the mod_lua multipart parser (r:parsebody() called from Lua scripts). The Apache httpd team is not aware of an exploit for the vulnerabilty though it might be possible to craft one. This issue affects Apache HTTP Server 2.4.51 and earlier.

References

Track CVEs across your fleet automatically

Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2021-40438. Free for 1 server.

Get started free