Apache HTTP Server 2.4.49/2.4.50 | CVE-2021–42013
Apache HTTP Server 2.4.49 and 2.4.50 mishandled URL decoding, so a crafted path could escape the web root and reach /bin/sh through the CGI module. An attacker could then run arbitrary commands on the server and obtain a reverse shell.
medium.com
Published on medium.com
Bu çalışmada, Apache HTTP Server 2.4.49 ve 2.4.50 sürümlerinde keşfedilen ve CVE-2021–42013 olarak tanımlanan kritik bir uzaktan kod çalıştırma (RCE) zafiyetinin pratik istismar süreci anlatılmıştır. Zafiyet, hatalı URL çözümleme ve CGI dosyalarının kontrolsüz çalıştırılmasından kaynaklanmaktadır.
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 the server decoded the request path twice, so an encoded dot-dot sequence slipped past the traversal check and reached a shell binary through CGI.
Impact
An attacker could run arbitrary commands on the server and obtain an interactive shell, giving full control of the host.
What the attacker needed
Apache 2.4.49 or 2.4.50; CGI module enabled; network access to the server
The fix
The server should be updated to version 2.4.51 or later, and active modules and file permissions should be reviewed.
How it was found
- Send a request to the cgi-bin path with double-encoded dot segments ending in the shell binary.
- Include a body that prints a plain-text content type and then runs a command.
- Observe the command output in the response to confirm execution.
- Repeat the request with curl using path-as-is and a plain-text content type.
- Start a listener and send a reverse shell command through the same path to get a shell.
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.
The web server is supposed to keep requests inside the website folder, but a specially encoded address tricked it into stepping outside that folder. Because a feature that runs scripts was switched on, the attacker could point the server at a system shell and make it run commands. This gave the attacker control of the machine, not just the website.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.