
Strumento di analisi statica delle patch basato su Python per studiare la causa principale e la risoluzione di CVE-2021-41773 (Path Traversal di Apache HTTP Server) confrontando il codice sorgente vulnerabile di Apache HTTP Server 2.4.49 con l'implementazione corretta 2.4.51.
Uno strumento di analisi statica delle patch basato su Python per studiare la causa principale e la risoluzione di CVE-2021-41773 (Path Traversal di Apache HTTP Server) confrontando il codice sorgente vulnerabile di Apache HTTP Server 2.4.49 con l'implementazione corretta 2.4.51.
Il progetto esegue un'analisi semantica del codice sorgente invece di un semplice diff testuale. Estrae informazioni strutturali dalla funzione target, confronta entrambe le versioni, deduce le modifiche rilevanti per la sicurezza e genera report di analisi professionali.
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
Clona il repository
git clone https://github.com/KunalKhandelwal-dev/cve-2021-41773-source-code-analysis.git
Entra nel progetto
cd cve-2021-41773-source-code-analysis
Esegui lo script di configurazione automatico.
sudo bash setup.sh
Lo script di configurazione esegue automaticamente le seguenti operazioni:
Esempio di output
[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
=========================================================
Esegui
cd scripts
sudo python3 verify_lab.py
Verifica riuscita
Lo strumento di verifica controlla:
Spostati nella directory scripts.
cd scripts
Esegui
sudo python3 analyze_patch.py
Esempio di output
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
Dopo un'esecuzione riuscita vengono generati i seguenti report:
analysis/
├── analysis.md
├── analysis.json
└── analysis.html
Load Apache Source
│
▼
Extract Target Function
│
▼
Extract Structural Information
│
▼
Compare Vulnerable vs Patched
│
▼
Security Reasoning
│
▼
Generate Reports
Il motore di ragionamento identifica miglioramenti di sicurezza come:
Questo progetto è pensato per:
Questo progetto è rilasciato sotto la Licenza MIT.
Kunal Khandelwal
B.Tech Ingegneria Informatica (Cyber Security)
Ricerca sulla Sicurezza | Sicurezza delle Applicazioni | Docker | Analisi del Codice Sorgente