Skip to content
Server Security Center
KEVcritical9.1

CVE-2024-38475: Apache HTTP Server Improper Escaping of Output

Apache HTTP Server · listed in the CISA catalog of actively exploited vulnerabilities since 2025-05-01.

CVSS v3.1 (CVE record)
9.1
critical
EPSS (exploit probability, 30 days)
>99.9%
among the highest 0.1% of all CVEs
Added to CISA KEV
2025-05-01
US federal due date 2025-05-22
Ubuntu priority
high

CVE-2024-38475 explained

CVE-2024-38475 is an improper output escaping flaw in mod_rewrite in Apache HTTP Server 2.4.59 and earlier. Certain server-context rewrite substitutions let a remote attacker reach filesystem locations the server may serve but that no URL is meant to expose. This can lead to code execution or source code disclosure, and the flaw is listed in the CISA Known Exploited Vulnerabilities catalog.

Impact

A remote, unauthenticated attacker can map URLs to files that are permitted to be served but not intentionally reachable. No user interaction is needed. The result can be code execution or disclosure of source code, with high impact on confidentiality and integrity. Only configurations whose server-context RewriteRule substitutions start with a backreference or variable as the first segment are affected.

Who is affected

The apache2 source package is affected on all listed releases, and all have fixed versions. Debian 12 (bookworm): 2.4.61-1~deb12u1. Ubuntu 24.04 LTS: 2.4.58-1ubuntu8.2. Ubuntu 22.04 LTS: 2.4.52-1ubuntu4.10. Ubuntu 20.04 LTS: 2.4.41-4ubuntu3.19. Ubuntu 18.04 LTS: 2.4.29-1ubuntu4.27+esm3 via Ubuntu Pro (ESM). End-of-life Ubuntu 16.04 LTS and 14.04 LTS have fixes only through Ubuntu Pro (ESM): 2.4.18-2ubuntu3.17+esm13 and 2.4.7-1ubuntu4.22+esm10.

Written with AI from the data on this page and checked against it automatically.

Official 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.

CISA required action: Apply mitigations per vendor instructions, follow applicable BOD 22-01 guidance for cloud services, or discontinue use of the product if mitigations are unavailable.

CISA notes

Upstream versions (CVE record)

From the CVE record published by the vendor or CVE numbering authority.

  • Apache Software Foundation Apache HTTP Server
    Affected
    • ≥ 2.4.0, ≤ 2.4.59
    Fixed in
    not stated

Ubuntu and Debian releases

A server is vulnerable if it has a package built from the listed source package installed in a version lower than the fixed version for its release.

What to do

  1. Update the apache2 package to the fixed version for your release.
  2. On Ubuntu 14.04, 16.04 and 18.04 LTS, enable Ubuntu Pro (ESM) to get the fix, or upgrade to a supported release.
  3. Restart Apache after updating so the patched code is loaded.
  4. Test RewriteRules afterwards; some unsafe rules will stop working after the fix.
  5. Only re-enable the UnsafePrefixStat rewrite flag on a rule after confirming its substitution is properly constrained.

Written with AI from the data on this page and checked against it automatically.

Check and fix on a server

Run on each Ubuntu or Debian server. Replace apache2 with the source package from the table above.

1. Show installed packages built from the source package, with their versions

dpkg-query -W -f='${binary:Package} ${Version} ${source:Package}\n' | awk '$3=="apache2"'

2. Compare each installed version with the fixed version for your release from the table

I=INSTALLED_VERSION; F=FIXED_VERSION   # replace both
dpkg --compare-versions "$I" lt "$F"; case $? in 0) echo vulnerable ;; 1) echo "fixed or newer" ;; *) echo "check the versions" ;; esac

3. Install the fix

sudo apt update && sudo apt install --only-upgrade $(dpkg-query -W -f='${binary:Package} ${source:Package}\n' | awk '$2=="apache2"{print $1}')

Services keep running the old code until they are restarted – restart the affected service or check with needrestart.

Rows marked “fix via Ubuntu Pro”: these fixes are only installable with an Ubuntu Pro subscription (ESM). Attach the machine first (sudo pro attach, then sudo pro enable esm-infra esm-apps), then run the commands above.

CISA's assessment (SSVC)

Exploitation
Exploited in the wild
Automatable
Yes – attackers can automate it at scale
Technical impact
Total – full control of the component or total information disclosure

Weakness: CWE-116 Improper Encoding or Escaping of Output

Questions about CVE-2024-38475

Is my server affected if I don't use mod_rewrite?
The flaw is in mod_rewrite. It affects substitutions in server context that use a backreference or variable as the first segment of the substitution. Updating is still recommended on all systems running the affected apache2 package.
Why did some rewrite rules break after updating?
The fix intentionally breaks some unsafe RewriteRules. The UnsafePrefixStat rewrite flag can restore the old behavior for a rule, but only use it once the substitution is appropriately constrained.
Is this being exploited?
Yes. CISA added CVE-2024-38475 to its Known Exploited Vulnerabilities catalog on 2025-05-01. Whether it is used in ransomware campaigns is unknown.

Written with AI from the data on this page and checked against it automatically.

References

Data: CISA Known Exploited Vulnerabilities (public domain) · CVE Program records incl. CISA ADP enrichment · OSV.dev (CC BY 4.0) incl. Ubuntu and Debian security data · FIRST EPSS · endoflife.date. Updated automatically – facts last changed 2026-11-21. Always confirm with the vendor's or distribution's advisory before patching.