CVE DatabaseCVE-2024-38475
한국어 권고문 →
CVE-2024-384759.1/CRITICALCISA KEVCWE-116

Apache HTTP Server mod_rewrite Improper Output Escaping Remote Code Execution and Source Code Disclosure (CVE-2024-38475)

⚡ Jump to Patch
Affected Vendors
apache
Affected Components
http_server
Published Date
2024-07-01
CVSS v3.1
9.1
CRITICAL
EPSS (30d)
100.0%
FIRST.org
CISA KEV
Exploited

Executive & SecOps Summary

SECOPS ASSESSMENT
Affected Scope

Apache HTTP Server versions 2.4.59 and earlier, specifically environments utilizing mod_rewrite rules where substitutions in server context use backreferences or variables as the first segment.

Impact

Attackers can map URLs to restricted filesystem locations, leading to unauthorized source code disclosure or arbitrary code execution (RCE).

Mitigation

Immediately upgrade Apache HTTP Server to version 2.4.60 or later, and review/restrict unsafe RewriteRules.

Affected Products & Version Scope

Apache HTTP Server 2.4.59 and earlier versions with mod_rewrite enabled and configured with vulnerable substitution rules.

Remediation & Live Workaround Commands

PATCH & WORKAROUND

1. Official Patch & Version Upgrade Commands

The primary remediation is to upgrade Apache HTTP Server to the latest secure release (2.4.60 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

2. Temporary Workaround & Hardening Configuration

If an immediate upgrade is not feasible, review your httpd.conf or .htaccess files. Note that some unsafe RewriteRules will break after upgrading; the UnsafePrefixStat flag can be used to opt back in once you ensure the substitution is appropriately constrained.

apache
# Avoid unsafe rules where variables/backreferences start the substitution:
# RewriteRule ^/(.*) %{DOCUMENT_ROOT}/$1 [L]

# Hardening: Ensure strict regular expression matching and restrict directory access.
# If upgrading breaks existing rules, verify security and apply the opt-in flag if necessary:
# RewriteRule ^/(.*) %{DOCUMENT_ROOT}/$1 [L,CO=...,UnsafePrefixStat]

3. Log Audit & IoC Verification Commands

Use the following commands to check your current Apache version and inspect access logs for potential exploitation attempts.

bash
# 1. Verify the running Apache version
httpd -v 2>&1 || apache2 -v

# 2. Scan access logs for suspicious directory traversal or unexpected script execution attempts
grep -E '(/\.\./|/cgi-bin/|\?.*=)' /var/log/apache2/access.log /var/log/httpd/access_log 2>/dev/null | head -n 20
Interactive SecOps Remediation Checklist
0/4 (0%)
Recommended Security Control & Mitigation Partner
Cloudflare Enterprise & Pro WAF
As this vulnerability is actively exploited in the wild (CISA KEV), immediately upgrade Apache HTTP Server to version 2.4.60 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-2024-38475) is caused by improper escaping of output in the mod_rewrite module of Apache HTTP Server (CWE-116). When a RewriteRule configured in the server context uses a backreference (e.g., $1, %1) or a variable (e.g., %{REQUEST_URI}) as the first segment of its substitution, the lack of strict validation allows malicious input to bypass directory boundaries.

2. Exploitation Mechanics & Attack Scenario

An attacker crafts a malicious URL request containing specific directory traversal or control characters. Because mod_rewrite fails to properly escape these characters during substitution, the engine maps the request to an internal filesystem path that is otherwise restricted or not directly reachable via standard URLs. This allows the attacker to force the execution of internal scripts (like CGI) or download sensitive source code files.

3. Infrastructure & Business Impact

With a CVSS score of 9.1 (Critical) and its inclusion in the CISA KEV (Known Exploited Vulnerabilities) catalog, this vulnerability poses an active and severe threat. Successful exploitation can lead to full server compromise via Remote Code Execution (RCE) or the exposure of proprietary source code and hardcoded credentials, severely impacting business confidentiality and infrastructure integrity.

Official Vendor Advisories & References

NVD Original English Description

Improper escaping of output in mod_rewrite in Apache HTTP Server 2.4.59 and earlier allows an attacker to map URLs to filesystem locations that are permitted to be served by the server but are not intentionally/directly reachable by any URL, resulting in code execution or source code disclosure. Substitutions in server context that use a backreferences or variables as the first segment of the substitution are affected.  Some unsafe RewiteRules will be broken by this change and the rewrite flag "UnsafePrefixStat" can be used to opt back in once ensuring the substitution is appropriately constrained.

Frequently Asked SecOps Questions (CVE-2024-38475)

FAQ

Q1. How critical is CVE-2024-38475 and is it actively exploited in the wild?

CVE-2024-38475 is rated CVSS 9.1 (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-2024-38475?

Primary impacted vendors include apache across http_server. Scope summary: Apache HTTP Server 2.4.59 and earlier versions with mod_rewrite enabled and configured with vulnerable substitution rules.

Q3. What temporary mitigations or workarounds exist for CVE-2024-38475 before patching?

[Mitigation] Immediately upgrade Apache HTTP Server to version 2.4.60 or later, and review/restrict unsafe RewriteRules. 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-2024-38475

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-2024-38475 Apache HTTP Server mod_rewrite Improper Output Escaping Remote Code Execution and Source Code Disclosure (CVE-2024-38475) (CVSS 9.1) - Patch & Workaround | CVE Pulse