
Ein auf Python basierendes Tool zur statischen Patch-Analyse, das die Ursache und Behebung von CVE-2021-41773 (Apache HTTP Server Path Traversal) untersucht, indem es den verwundbaren Quellcode von Apache HTTP Server 2.4.49 mit der gepatchten Implementierung von 2.4.51 vergleicht.
Ein Python-basiertes statisches Patch-Analyse-Tool zur Untersuchung der Grundursache und Behebung von CVE-2021-41773 (Apache HTTP Server Path Traversal) durch den Vergleich des verwundbaren Quellcodes von Apache HTTP Server 2.4.49 mit der gepatchten Implementierung von 2.4.51.
Das Projekt führt eine semantische Quellcode-Analyse durch statt eines einfachen textbasierten Vergleichs. Es extrahiert strukturelle Informationen aus der Zielfunktion, vergleicht beide Versionen, leitet sicherheitsrelevante Änderungen ab und erstellt professionelle Analyseberichte.
Apache Source Code
│
▼
parser.py
│
▼
extractor.py
│
▼
comparator.py
│
▼
reasoning.py
│
▼
reports.py
cve-2021-41773-source-code-analysis
│
├── docker
│ ├── apache249
│ │ ├── Dockerfile # Builds Apache HTTP Server 2.4.49 container
│ │ └── docker-compose.yml # Starts vulnerable Apache container
│ │
│ └── apache251
│ ├── Dockerfile # Builds Apache HTTP Server 2.4.51 container
│ └── docker-compose.yml # Starts patched Apache container
│
├── labs # Stores downloaded Apache source code
│
├── references
│ └── resources.md # Reference material for CVE research
│
├── scripts
│ ├── patch_analysis
│ │ ├── __init__.py # Initializes the analysis package
│ │ ├── parser.py # Extracts target C functions from Apache source
│ │ ├── extractor.py # Extracts variables, calls, conditions and security capabilities
│ │ ├── comparator.py # Compares vulnerable and patched function structures
│ │ ├── reasoning.py # Performs security reasoning on detected changes
│ │ ├── reports.py # Coordinates report generation
│ │ ├── markdown_report.py # Generates Markdown analysis report
│ │ ├── json_report.py # Generates JSON analysis report
│ │ └── html_report.py # Generates HTML analysis report
│ │
│ ├── analyze_patch.py # Main entry point for patch analysis
│ ├── verify_lab.py # Verifies Docker lab configuration
│ └── debug.py # Displays raw comparison output for debugging
│
├── analysis # Generated analysis reports
│
├── setup.sh # Automatically prepares the complete lab
│
├── LICENSE
└── README.md
Repository klonen
git clone https://github.com/KunalKhandelwal-dev/cve-2021-41773-source-code-analysis.git
In das Projektverzeichnis wechseln
cd cve-2021-41773-source-code-analysis
Führen Sie das automatisierte Setup-Skript aus.
sudo bash setup.sh
Das Setup-Skript führt automatisch die folgenden Aufgaben aus:
Beispielausgabe
[INFO] Checking required tools...
[SUCCESS] Required tools found.
[INFO] Checking Docker...
[SUCCESS] Docker is running.
[INFO] Downloading Apache HTTP Server 2.4.49...
[SUCCESS] Apache 2.4.49 downloaded.
[INFO] Downloading Apache HTTP Server 2.4.51...
[SUCCESS] Apache 2.4.51 downloaded.
[INFO] Building Docker images...
[SUCCESS] Docker images built.
[INFO] Starting Apache containers...
[SUCCESS] Containers started.
=========================================================
[SUCCESS] Apache CVE Lab Setup Complete
=========================================================
Führen Sie aus
cd scripts
sudo python3 verify_lab.py
Erfolgreiche Verifizierung
Das Verifizierungstool prüft:
Wechseln Sie in das Verzeichnis scripts.
cd scripts
Führen Sie aus
sudo python3 analyze_patch.py
Beispielausgabe
Apache HTTP Server Patch Analysis Report
Security Findings
[MEDIUM]
Percent decoding introduced or modified
[MEDIUM]
Hexadecimal validation introduced or modified
[HIGH]
Directory traversal handling improved
[HIGH]
Path normalization pipeline updated
[CRITICAL]
Traversal protection strengthened
Nach erfolgreicher Ausführung werden die folgenden Berichte generiert:
analysis/
├── analysis.md
├── analysis.json
└── analysis.html
Load Apache Source
│
▼
Extract Target Function
│
▼
Extract Structural Information
│
▼
Compare Vulnerable vs Patched
│
▼
Security Reasoning
│
▼
Generate Reports
Die Reasoning-Engine identifiziert Sicherheitsverbesserungen wie:
Dieses Projekt richtet sich an:
Dieses Projekt wird unter der MIT-Lizenz veröffentlicht.
Kunal Khandelwal
B.Tech Informatik (Cybersicherheit)
Sicherheitsforschung | Anwendungssicherheit | Docker | Quellcodeanalyse