CVE-2024-38475: Apache HTTP Server Improper Escaping of Output Vulnerability
Apache HTTP Server contains an improper escaping of output vulnerability in modrewrite that 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.
Other sources
CVE-2024-38474 Substitution encoding issue in modrewrite in Apache HTTP Server 2.4.59 and earlier allows attacker to execute scripts in directories permitted by the configuration but not directly reachable by any URL or source disclosure of scripts meant to only to be executed as CGI. Users are recommended to upgrade to version 2.4.60, which fixes this issue. Some RewriteRules that capture and substitute unsafely will now fail unless rewrite flag "UnsafeAllow3F" is specified. CVE-2024-38475 Improper escaping of output in modrewrite 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.
— F5
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/apache2to a version that resolves this vulnerability.Fixed in 2.4.62-1~deb11u1Fixed in 2.4.61-1~deb11u1Fixed in 2.4.62-1~deb12u1Fixed in 2.4.62-1~deb12u2Fixed in 2.4.62-3 - Upgrade
Upgrade
F5 BIG-IP and BIG-IQ Centralized Managementto a version that resolves this vulnerability.Fixed in 17.5.017.1.2.2 - Upgrade
Upgrade
F5 BIG-IP and BIG-IQ Centralized Managementto a version that resolves this vulnerability.Fixed in 16.1.6 - Upgrade
Upgrade
Apache HTTP Serverto a version that resolves this vulnerability.Fixed in 2.4.60 - Upgrade
Upgrade
debian/apache2to a version that resolves this vulnerability.Fixed in 2.4.62-1~deb11u1 - Upgrade
Upgrade
debian/apache2to a version that resolves this vulnerability.Fixed in 2.4.61-1~deb11u1 - Upgrade
Upgrade
debian/apache2to a version that resolves this vulnerability.Fixed in 2.4.62-1~deb12u1 - Upgrade
Upgrade
debian/apache2to a version that resolves this vulnerability.Fixed in 2.4.62-1~deb12u2 - Upgrade
Upgrade
debian/apache2to a version that resolves this vulnerability.Fixed in 2.4.62-3 - Configuration
If a RewriteRule that previously relied on unsafe substitution must continue to work, add the UnsafeAllow3F flag to the RewriteRule only after ensuring the substitution is safely constrained.
Apache HTTP Server (mod_rewrite) RewriteRule flag UnsafeAllow3F = enable/use when needed - Configuration
If substitutions in server context that use backreferences or variables as the first segment must be allowed, add the UnsafePrefixStat flag to opt back in only after ensuring the substitution is appropriately constrained.
Apache HTTP Server (mod_rewrite) RewriteRule flag UnsafePrefixStat = enable/use when needed - Compensating control
Apply mitigations per vendor instructions, follow applicable BOD 22-01 guidance for cloud services, or discontinue use of the product if mitigations are unavailable.
Event History
Frequently Asked Questions
What is the severity of CVE-2024-38475?
CVE-2024-38475 has a high severity rating due to its potential to allow unauthorized script execution.
How do I fix CVE-2024-38475?
To fix CVE-2024-38475, update to the patched versions of Apache HTTP Server 2.4.62 or later.
What versions of Apache HTTP Server are affected by CVE-2024-38475?
CVE-2024-38475 affects Apache HTTP Server versions 2.4.59 and earlier.
What products other than Apache are impacted by CVE-2024-38475?
CVE-2024-38475 also affects IBM Planning Analytics and specific versions of F5 BIG-IP and Traffix Systems.
Can CVE-2024-38475 lead to data leakage?
Yes, CVE-2024-38475 can allow disclosure of scripts that should only be executed as server-side processes.