Skip to content
Path traversal Disclosed report Advanced CVE-2024-38475

important: Apache HTTP Server weakness in mod_rewrite when first segment of substitution matches filesystem path. (CVE-2024-38475)

Apache HTTP Server's mod_rewrite module improperly escapes output when the first segment of a substitution uses backreferences or variables, allowing an attacker to map URLs to filesystem locations that are served but not directly reachable. This could lead to code execution or source code disclosure.

Orange Tsai .8361) Follow

Originally disclosed on HackerOne

Bounty$4,920 High View original
  • Fixed in 37 hours
  • Paid in 37 hours
  • Disclosed after 10 days

Summary by the program

###important: Apache HTTP Server weakness in mod_rewrite when first segment of substitution matches filesystem path. (CVE-2024-38475)

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.

Acknowledgements: finder: Orange Tsai (@orange_8361) from DEVCORE

Reported to security team: 2024-04-01 fixed by r1918561 in 2.4.x: 2024-07-01 Update 2.4.60 released: 2024-07-01 Affects: 2.4.0 through 2.4.59

The report

I reported this vulnerability through the official Apache HTTP Server security email on April 1, 2024, and received a fix along with a CVE number on July 1, 2024. You can check detailed information from there:

https://httpd.apache.org/security/vulnerabilities_24.html

Impact

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.

The original report as published on HackerOne, by orange. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, mod_rewrite does not properly escape output when the first segment of a substitution is a backreference or variable, allowing path manipulation.

Impact

An attacker could map URLs to filesystem locations that are served but not directly reachable, potentially leading to code execution or source code disclosure.

What the attacker needed

Apache HTTP Server 2.4.0-2.4.59; mod_rewrite enabled; rewrite rule with backreference/variable as first segment

The fix

The issue was fixed in Apache HTTP Server 2.4.60; unsafe rewrite rules can use the UnsafePrefixStat flag to opt back in after ensuring the substitution is appropriately constrained.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Apache HTTP Server is web server software. Its mod_rewrite module changes URLs according to rules. A flaw in how it handles certain rewrite rules lets an attacker access files on the server that are normally hidden, which could let them run code or read source code.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by Orange Tsai .8361)

View all

22 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.