$ cat writeup.md…
$ cat writeup.md…
hackviser
Task: Apache HTTP Server 2.4.49/2.4.50 with CVE-2021-42013 path traversal and RCE vulnerability, goal is to read /secret.txt. Solution: Double URL-encoded path traversal (%%32%65%%32%65 = ..) through /cgi-bin/ ScriptAlias to reach /bin/sh and execute cat /secret.txt.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
Apache HTTP Server is a popular open-source web server used to host and serve web content. This laboratory contains the CVE-2021-42013 vulnerability found in Apache HTTP Server versions 2.4.49 and 2.4.50. This vulnerability allows attackers to perform path traversal and remote code execution attacks, enabling the execution of arbitrary commands on the server and potentially taking control of the system. The goal is to read the secret in /secret.txt.
English summary: An Apache HTTP Server 2.4.50 instance is vulnerable to CVE-2021-42013. The goal is to exploit the path traversal / RCE vulnerability to read /secret.txt from the filesystem root.
CVE-2021-42013 is a path traversal vulnerability in Apache HTTP Server versions 2.4.49 and 2.4.50. It is a bypass of the incomplete fix for CVE-2021-41773 (which was patched in 2.4.50 but insufficiently).
The core issue: Apache's path normalization checks for ../ sequences, but double URL encoding bypasses this check:
%%32%65 → first decode → %2e → second decode → .%%32%65%%32%65/ decodes to ../ after both decoding passesWhen the traversal path goes through a ScriptAlias directive (like /cgi-bin/), Apache treats the resolved path as a CGI script and executes it. By traversing to /bin/sh, an attacker can execute arbitrary shell commands via POST body — escalating path traversal to Remote Code Execution.
Key prerequisites:
mod_cgi or mod_cgid enabledScriptAlias directive (e.g., /cgi-bin/)Require all granted or permissive directory configurationIdentified the target Apache version from HTTP response headers:
curl -sI http://172.20.1.166/
HTTP/1.1 200 OK
Server: Apache/2.4.50 (Unix)
Apache 2.4.50 — vulnerable to CVE-2021-42013.
...
$ grep --similar