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-lab — Educational FastAPI lab demonstrating CVE-2021-41773 directory traversal and local file inclusion, with a vulnerable server, patched code, and encoded payload examples for local security training. | Kitploit
Tools/GitHubGitHub/kunalkhandelwal-dev/cve-2021-41773-lab
Vulnerability AnalysisWeb Application ExploitationWeb SecurityLearning & EducationLabs & Practice
GitHubkunalkhandelwal-dev/cve-2021-41773-lab

cve-2021-41773-lab

Educational FastAPI lab demonstrating CVE-2021-41773 directory traversal and local file inclusion, with a vulnerable server, patched code, and encoded payload examples for local security training.

View Repository
21 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 — Minimal FastAPI Lab

A small, self-contained FastAPI lab demonstrating how decoding user input before validating filesystem boundaries can lead to directory traversal and local file inclusion (LFI), modeled after the Apache HTTP Server issues CVE-2021-41773.


Features

  • Minimal, easy-to-read FastAPI examples: a vulnerable server and a patched server
  • Demonstrates single-encoded (%2e) and double-encoded (%252e) bypasses
  • Root endpoint includes quick payloads for testing with curl
  • No Docker required — runs locally with uvicorn

Repository Layout

  • patched_app.py — secured implementation (uses canonical path checks)
  • vulnerable_app.py — intentionally vulnerable implementation
  • secret.txt — out-of-bounds secret file used as exploit target
  • webroot/test.txt — public file served by the example
  • README.md — this file

  • Requirements

    • Python 3.8+
    • pip

    Install runtime dependencies:

    root@kitploit:~
    pip install fastapi uvicorn
    

    Quickstart

    1. Create and activate a virtual environment (Windows PowerShell example):
    root@kitploit:~
    python -m venv venv
    .\venv\Scripts\activate
    
    1. Install dependencies:
    root@kitploit:~
    pip install fastapi uvicorn
    
    1. Run the vulnerable server (port 8011):
    root@kitploit:~
    uvicorn vulnerable_app:app --port 8011
    

    Open http://127.0.0.1:8011/ in your browser — the root endpoint shows common payloads and notes.

    To observe the fix, stop the vulnerable server and run the patched server:

    root@kitploit:~
    uvicorn patched_app:app --port 8011
    

    Example Requests (curl)

    • Baseline access to a public file:
    root@kitploit:~
    curl --path-as-is http://localhost:8011/icons/test.txt
    
    • CVE-2021-41773 (single encoding) — bypasses naive boundary checks:
    root@kitploit:~
    curl --path-as-is "http://localhost:8011/icons/.%2e/secret.txt"
    
    • CVE-2021-42013 (double encoding) — bypasses filters that don't decode repeatedly:
    root@kitploit:~
    curl --path-as-is "http://localhost:8011/icons/.%252e/secret.txt"
    

    Against the vulnerable server these payloads may return secret.txt. Against the patched server they should be rejected (HTTP 403).


    How the Patch Works (high level)

    1. Fully decode the incoming path (handle multiple encoding layers).
    2. Resolve the canonical filesystem path with os.path.realpath().
    3. Enforce that the resolved path is inside the intended webroot directory — deny otherwise.

    This enforces correct ordering: decode → canonicalize → authorize.


    Safety & Usage

    This repository is for local, educational use only. Do not expose the vulnerable server to public networks.


    License

    MIT License


    Author

    Kunal Khandelwal — Security Researcher, Application Security

    Download Tool