
أداة تحليل ثابت للتصحيحات مبنية على Python لدراسة السبب الجذري ومعالجة ثغرة CVE-2021-41773 (تجاوز المسار في Apache HTTP Server) من خلال مقارنة الكود المصدري لخادم Apache HTTP Server الإصدار 2.4.49 المعرّض للثغرة مع تنفيذ الإصدار المُصحَّح 2.4.51.
أداة تحليل ثابت للترقيعات مبنية بلغة بايثون لدراسة السبب الجذري والمعالجة لثغرة CVE-2021-41773 (تجاوز المسار في Apache HTTP Server) من خلال المقارنة بين الكود المصدري الضعيف Apache HTTP Server 2.4.49 وتنفيذ النسخة المرقّعة 2.4.51.
يقوم المشروع بإجراء تحليل دلالي للكود المصدري بدلاً من المقارنة النصية البسيطة. يستخرج المعلومات الهيكلية من الدالة المستهدفة، ويقارن بين النسختين، ويستنتج التغييرات ذات الصلة بالأمان، وينشئ تقارير تحليل احترافية.
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
استنساخ المستودع
git clone https://github.com/KunalKhandelwal-dev/cve-2021-41773-source-code-analysis.git
الدخول إلى المشروع
cd cve-2021-41773-source-code-analysis
قم بتشغيل سكربت الإعداد التلقائي.
sudo bash setup.sh
يقوم سكربت الإعداد تلقائيًا بتنفيذ المهام التالية:
مثال على المخرجات
[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
=========================================================
قم بتشغيل
cd scripts
sudo python3 verify_lab.py
تحقق ناجح
تتحقق الأداة من:
انتقل إلى دليل السكربتات.
cd scripts
قم بتشغيل
sudo python3 analyze_patch.py
مثال على المخرجات
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
بعد التنفيذ الناجح يتم إنشاء التقارير التالية:
analysis/
├── analysis.md
├── analysis.json
└── analysis.html
Load Apache Source
│
▼
Extract Target Function
│
▼
Extract Structural Information
│
▼
Compare Vulnerable vs Patched
│
▼
Security Reasoning
│
▼
Generate Reports
يحدد محرك الاستدلال تحسينات أمنية مثل:
هذا المشروع مخصص لـ:
تم إصدار هذا المشروع بموجب رخصة MIT.
Kunal Khandelwal
بكالوريوس هندسة علوم الحاسب (الأمن السيبراني)
أبحاث أمنية | أمن التطبيقات | Docker | تحليل الكود المصدري