Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) (CVE-2021-42013)
The fix for a previous path traversal flaw in Apache HTTP Server 2.4.50 was incomplete, allowing an attacker to map URLs to files outside configured directories. If those files are not protected by default access controls and CGI is enabled, this could lead to remote code execution.
- Triaged in 18 hours
- Fixed in 4 days
- Paid in 4 days
- Disclosed after 4 days
Summary by the program
It was found that the fix for CVE-2021-41773 in Apache HTTP Server 2.4.50 was insufficient. 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 only affects Apache 2.4.49 and Apache 2.4.50 and not earlier versions.
Acknowledgements:
Reported by Juan Escobar from Dreamlab Technologies Reported by Fernando Muñoz from NULL Life CTF Team Reported by Shungo Kumasaka Reported by Nattapon Jongcharoen
Reported to security team: 2021-10-06 fixed by r1893977, r1893980, r1893982 in 2.4.x: 2021-10-07 Update 2.4.51 released: 2021-10-07 Affects: 2.4.50, 2.4.49
https://httpd.apache.org/security/vulnerabilities_24.html
The report
It was found that the fix for CVE-2021-41773 in Apache HTTP Server 2.4.50 was insufficient. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives.
This issue only affects Apache 2.4.49 and Apache 2.4.50 and not earlier versions.
My friend Juan Escobar @itsecurityco and me (Fernando Munoz) reported this internally to Apache HTTPd project and worked with them to test the new patch before the new version was released.
Impact
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.
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 the patch for CVE-2021-41773 did not fully normalise or block all encoded path traversal sequences, allowing URLs to escape Alias-configured directories.
Impact
If files outside the aliased directories are not protected by the default 'require all denied' configuration, requests can succeed; if CGI scripts are also enabled for those paths, this could allow remote code execution.
What the attacker needed
Apache HTTP Server 2.4.49 or 2.4.50; Alias-like directives configured; Files outside aliased dirs not denied by default; CGI scripts enabled for aliased paths (for RCE)
The fix
The issue was fixed in Apache HTTP Server 2.4.51 by revisions r1893977, r1893980, and r1893982.
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 path traversal bug lets someone trick a web server into reading files it should not, by using special characters in the URL to climb out of the intended folder. Here, the server's attempt to block this was incomplete, so an attacker could still reach files outside the allowed area. If those files are scripts that the server can run, the attacker might be able to execute commands on the server.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.