Path traversal and file disclosure vulnerability in Apache HTTP Server 2.4.49
A change to path normalization in Apache HTTP Server 2.4.49 allowed crafted URLs to reach files outside directories configured by Alias-like directives. An attacker could read sensitive files, and if CGI scripts were enabled for those aliased paths, could achieve remote code execution.
Originally disclosed on HackerOne
- Fixed in 20 hours
- Paid in 20 hours
- Disclosed after 23 hours
Summary by the program
A flaw was found in a change made to path normalization in Apache HTTP Server 2.4.49. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives.
If files outside of these directories are not protected by the usual default configuration "require all denied", these requests can succeed. If CGI scripts are also enabled for these aliased pathes, this could allow for remote code execution.
This issue is known to be exploited in the wild.
This issue only affects Apache 2.4.49 and not earlier versions.
Acknowledgements: This issue was reported by Ash Daulton along with the cPanel Security Team
Reported to security team: 2021-09-29 fixed by r1893775 in 2.4.x: 2021-10-01 Update 2.4.50 released: 2021-10-04 Affects: 2.4.49
https://httpd.apache.org/security/vulnerabilities_24.html
The report
A flaw was found in a change made to path normalization in Apache HTTP Server 2.4.49. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives. If files outside of these directories are not protected by the usual default configuration "require all denied", these requests can succeed. If CGI scripts are also enabled for these aliased paths, this could allow for remote code execution. This issue is known to be exploited in the wild. This issue only affects Apache 2.4.49 and not earlier versions. The fix in Apache HTTP Server 2.4.50 was found to be incomplete, see CVE-2021-42013.
Impact
The attacker may be able read the contents of unexpected files and expose sensitive data. If the targeted file is used for a security mechanism, then the attacker may be able to bypass that mechanism. For example, by reading a password file, the attacker could conduct brute force password guessing attacks in order to break into an account on the system.
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 a flaw in the path normalization change introduced in 2.4.49 that failed to correctly resolve traversal sequences before mapping URLs to filesystem paths.
Impact
The attacker may be able to read unexpected files and expose sensitive data, potentially bypass security mechanisms or, with CGI enabled on aliased paths, achieve remote code execution; the issue is known to be exploited in the wild.
What the attacker needed
Apache HTTP Server 2.4.49; Alias-like directives configured; Files not protected by default deny; CGI enabled for RCE
The fix
It was fixed in 2.4.50, though that fix was later found to be incomplete (CVE-2021-42013).
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.
A web server normally only serves files from folders it is told to share. A mistake in how this version cleaned up web addresses let someone ask for files in other folders on the machine. If those files were readable, private data could leak, and in some setups the attacker could even run their own code.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.