Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
工具/GitHubGitHub/kunalkhandelwal-dev/cve-2021-41773-source-code-analysis
漏洞分析代码分析Web安全学习与教育实验室与实践
GitHubkunalkhandelwal-dev/cve-2021-41773-source-code-analysis

cve-2021-41773-source-code-analysis

一款基于Python的静态补丁分析工具,用于通过对比存在漏洞的Apache HTTP Server 2.4.49源码与已修复的2.4.51实现,研究CVE-2021-41773(Apache HTTP Server路径遍历)的根本原因及修复方案。

查看仓库

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
23天前尚未审核

Apache HTTP Server CVE-2021-41773 源代码分析

一个基于 Python 的静态补丁分析工具,用于通过对比存在漏洞的 Apache HTTP Server 2.4.49 源代码与已修补的 2.4.51 实现,研究 CVE-2021-41773(Apache HTTP Server 路径遍历) 的根本原因与修复措施。

该项目执行的是语义级源代码分析,而非简单的基于文本的差异比较。它从目标函数中提取结构信息,比较两个版本,推断与安全相关的变更,并生成专业的分析报告。


功能特性

  • 静态源代码分析
  • 使用花括号匹配进行函数提取
  • 漏洞版本与已修补版本之间的结构比较
  • 安全能力检测
  • 补丁推理引擎
  • Markdown 报告生成
  • JSON 报告生成
  • HTML 报告生成
  • 自动化 Docker 实验环境搭建
  • 环境验证工具

项目架构

root@kitploit:~
Apache Source Code
        │
        ▼
 parser.py
        │
        ▼
 extractor.py
        │
        ▼
 comparator.py
        │
        ▼
 reasoning.py
        │
        ▼
 reports.py

项目结构

root@kitploit:~
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

环境要求

  • Python 3.10+
  • Docker
  • Docker Compose
  • Bash
  • Linux(已在 Kali Linux 上测试)

安装

克隆仓库

root@kitploit:~
git clone https://github.com/KunalKhandelwal-dev/cve-2021-41773-source-code-analysis.git

进入项目目录

root@kitploit:~
cd cve-2021-41773-source-code-analysis

环境搭建

运行自动化搭建脚本。

root@kitploit:~
sudo bash setup.sh

该搭建脚本会自动执行以下任务:

  • 检查所需工具
  • 验证 Docker 安装
  • 下载 Apache HTTP Server 2.4.49
  • 下载 Apache HTTP Server 2.4.51
  • 解压两个源代码树
  • 构建 Docker 镜像
  • 启动 Apache 容器
  • 创建分析环境

示例输出

root@kitploit:~
[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
=========================================================

验证环境

运行

root@kitploit:~
cd scripts

sudo python3 verify_lab.py

验证成功

image

验证工具会检查以下内容:

  • Docker 安装
  • Docker 守护进程
  • 正在运行的容器
  • Apache 版本
  • Apache 源代码
  • 目标函数
  • HTTP 服务
  • GDB 可用性

运行补丁分析

进入 scripts 目录。

root@kitploit:~
cd scripts

运行

root@kitploit:~
sudo python3 analyze_patch.py

示例输出

image

分析输出示例

root@kitploit:~
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

生成的报告

成功执行后,将生成以下报告:

root@kitploit:~
analysis/
├── analysis.md
├── analysis.json
└── analysis.html

分析流程

root@kitploit:~
Load Apache Source
        │
        ▼
Extract Target Function
        │
        ▼
Extract Structural Information
        │
        ▼
Compare Vulnerable vs Patched
        │
        ▼
Security Reasoning
        │
        ▼
Generate Reports

检测到的安全能力

  • 百分号编码/解码
  • 十六进制校验
  • 点段处理
  • 路径分隔符规范化
  • URI 规范化标志
  • 目录遍历防护

生成的发现

推理引擎可识别出以下安全改进:

  • 引入百分号解码
  • 引入十六进制校验
  • 改进了目录遍历处理
  • 更新了路径规范化
  • 加强了遍历防护

教育用途

本项目面向以下用途:

  • 安全研究人员
  • 学习 CVE 根因分析的学生
  • 安全软件工程
  • 静态源代码分析
  • 补丁差异分析
  • 漏洞研究

许可证

本项目基于 MIT 许可证发布。

作者

Kunal Khandelwal

B.Tech 计算机科学工程(网络安全)

安全研究 | 应用安全 | Docker | 源代码分析

下载工具