This Apache bug starts with your backend app and ends with Apache doing something it shouldn’t, and the first fix for it caused problems of its own.
At a glance
- CVE: CVE-2024-38476, another of the Apache bugs Orange Tsai of DEVCORE reported in 2024 and presented at Black Hat USA 2024 as “Confusion Attacks”.
- Severity: 9.8 (Critical) at NVD and CISA. Apache rates it “important”.
- Affected: Apache HTTP Server 2.4.0 through 2.4.59. NVD also lists NetApp Clustered Data ONTAP 9.0, and Apple shipped a fix for the copy of Apache in macOS Sequoia 15.1.
- Known exploited: Not on CISA’s KEV list.
What’s going on
Apache’s core has some old behaviour: if nothing has set a handler for a request, it treats the response’s Content-Type as the handler name. Now add a backend, such as a CGI script, that answers with a local Location header and a 200 status. Apache follows that with an internal redirect and carries the Content-Type along with it.
So if an attacker can control a backend’s response headers, say through a header-injection bug in your app, or because the backend itself is malicious, they can get Apache to run local handlers it never meant to expose. Orange Tsai’s examples include the server-status page and routing a request through mod_proxy. Apache sums up the possible results as information disclosure, SSRF (making your server send requests on the attacker’s behalf), or local script execution.
Who should care? Anyone on Apache 2.4.59 or older that sits in front of apps that set their own response headers, especially CGI scripts or anything that copies user input into headers like Location.
The fix had a sting in its tail
Apache’s fix changed how legacy, Content-Type-based handler setups work, and that tripped up some configs. Apache’s own note says some legacy uses of AddType to connect requests to a handler need to move to SetHandler.
It also caused a regression. In 2.4.60, some AddType-style setups could end up serving files’ source instead of running them. Apache’s own example is PHP scripts being served instead of interpreted. That was CVE-2024-39884, fixed in 2.4.61. The fix for that was incomplete too (CVE-2024-40725), and 2.4.62 finished the job. So for this CVE, 2.4.60 is the official “fixed in”, but 2.4.62 is the realistic floor.
Timeline
- Reported to Apache: 2024-04-01
- Disclosed and patched: 2024-07-01 (Apache HTTP Server 2.4.60)
- Regression fix: 2024-07-03 (2.4.61, CVE-2024-39884)
- Regression fully fixed: 2024-07-17 (2.4.62, CVE-2024-40725)
- Researcher’s write-up: 2024-08-09
- Apple fix in macOS Sequoia 15.1: 2024-10-28
== UPDATE ==
This has been patched for a long time, so it’s mainly about making sure you didn’t stop at 2.4.60 or 2.4.61.
- Patch available: Yep, since July 2024.
- Fixed in: Apache HTTP Server 2.4.60 for this CVE. Run 2.4.62 or later to avoid the source-disclosure regressions. The newest release on Apache’s page is 2.4.71, from 2026-11-11.
- How to apply: Update Apache through your package manager:
sudo apt update && sudo apt install --only-upgrade apache2on Debian/Ubuntu, orsudo dnf upgrade httpdon RHEL, Alma, Rocky or Fedora. Then runapachectl configtestand restart Apache. Distros backport fixes, so your version string may still read lower than 2.4.60. Check your distro’s security tracker for CVE-2024-38476 (and CVE-2024-40725) instead. If you wire up handlers withAddType, move them toSetHandleras Apache recommends, and check that your scripts still run rather than download. - If you can’t patch yet: Apache doesn’t offer a workaround other than upgrading. The attack depends on an attacker being able to shape a backend’s response headers, so in the meantime review apps (CGI scripts especially) that put user input into headers such as
LocationorContent-Type.
References
- https://httpd.apache.org/security/vulnerabilities_24.html
- https://nvd.nist.gov/vuln/detail/CVE-2024-38476
- https://blog.orange.tw/posts/2024-08-confusion-attacks-en/
- http://www.openwall.com/lists/oss-security/2024/07/01/9
- http://seclists.org/fulldisclosure/2024/Oct/11
- https://security.netapp.com/advisory/ntap-20240712-0001/