# POC-CVE-2021-41773

On the 5th of October 2021, a CVE detailing a path traversal attack on Apache HTTP Server v2.4.49 was released. Assigned the number CVE-2021-41773, it was released with the following description:

A flaw was found in a change made to path normalization in Apache HTTP Server 2.4.49. An attacker could use a path traversal attack to map URLs to files outside the expected document root. If files outside of the document root are not protected by "require all denied" these requests can succeed. Additionally (sic) this flaw could leak the source of interpreted files like CGI scripts. This issue is known to be exploited in the wild. This issue only affects Apache 2.4.49 and not earlier versions.

[+] Apache 2.4.49 without CGI enabled, we can only read files. We simply access the files that we want, url-encoding one of the . in each path segment.

[+] Apache 2.4.49 with CGI enabled
CGI will complicate the matter as the module will attempt to execute the retrieved file. For plaintext, like /etc/passwd, this can be problematic :). In order to execute or code, we can simply call sh or bash with the command in the body. Note that the Content-Type response header will also have to be emitted so that the client will know how to display the results.

[+] Apache 2.4.50
This particular example was fixed in version 2.4.50. However, the fix was incomplete and failed to account for a double-encoding of the URL.