CVE-2021–42013 Apache HTTP Server 2.4.49/2.4.50 Remote Code Exe
Apache HTTP Server versions 2.4.49 and 2.4.50 mishandle path normalisation, allowing crafted URLs to traverse directories and execute arbitrary commands. An attacker could use this to run code on a vulnerable server.
Published on medium.com
Hello! I am 0xYoussefIbrahim, and in this write-up, we will explore CVE-2021–42013, a critical vulnerability in Apache HTTP Server versions 2.4.49 and 2.4.50, which allows remote code execution (RCE) under certain configurations.
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 improper path normalisation and input validation in Apache's mod_proxy and related modules, which lets crafted URLs escape the intended directory.
Impact
An attacker could execute arbitrary commands on a vulnerable Apache server, leading to full remote code execution.
What the attacker needed
Apache 2.4.49 or 2.4.50; Certain module configurations; Network access to the server
The fix
Upgrade Apache HTTP Server to a version later than 2.4.50, as the text recommends patching.
How it was found
- Check the Apache server version to see if it is 2.4.49 or 2.4.50.
- Use the Metasploit module for Apache normalisation path RCE and set the target options.
- If the exploit fails because it tries HTTPS on port 443, set SSL to false.
- Run the exploit to open a session with the target machine.
- Use the shell to list files and directories and search for the flag file.
- Open a shell for remote access and capture the flag.
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.
This is a flaw in the Apache web server software. When it receives a web address containing special path characters, it can be tricked into treating a file outside the intended folder as if it were inside, and in some setups that leads to running commands on the machine. An attacker who can reach the server could then take control of it.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.