CVE-2021–42013 Apache HTTP Server 2.4.49 2.4.50 Remote Code Exe
Apache HTTP Server 2.4.49 and 2.4.50 contain a path traversal flaw that stems from an incomplete fix for an earlier vulnerability, allowing an attacker to reach files outside the document root and run commands. In the walkthrough the author uses a Metasploit module to read a file on the target.
Published on medium.com
CVE-2021–42013 is a critical Path Traversal and Remote Code Execution (RCE) vulnerability affecting Apache HTTP Server versions 2.4.49 and 2.4.50. It stems from an incomplete fix for the earlier CVE-2021–41773 vulnerability.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely an incomplete fix for the earlier path traversal issue left path normalisation still bypassable in these two versions.
Impact
An attacker could read files outside the served directory and, depending on configuration, execute commands on the server.
What the attacker needed
Network access to the web server; affected Apache version 2.4.49 or 2.4.50; Metasploit available to the attacker
The fix
Administrators should upgrade to version 2.4.51 or later and deny directory access outside the document root.
How it was found
- Scan the target to find open ports and service versions.
- Note that the web server version is one of the affected releases.
- Start Metasploit and select the Apache normalise path module.
- Set the target host, port, attacker host and disable SSL.
- Switch the module to direct Unix command execution mode.
- Set the command to read the target file and run the exploit.
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 write-up has not been written yet. The Original tab links to the source.
A web server normally only hands out files from the folder it is told to serve. Here a mistake in how it cleans up requested paths let someone ask for files outside that folder, and in some setups even run commands on the machine. The author shows this in a practice lab using an existing tool rather than writing the attack by hand.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.