CVE-2024-3094(XZ Utils后门)的安全审查,包括威胁建模、静态/动态代码分析、使用AFL++进行模糊测试,以及概念验证漏洞利用。包含用于可重现分析的Docker环境。
作者: 苏辛·伊万
日期: 2026年3月
本仓库包含对漏洞 CVE-2024-3094(XZ Utils 库中的供应链攻击)的完整安全审查结果。
工作目标:
工件:
| 文件 | 描述 |
|---|---|
docs/ThreatModel.md | STRIDE 威胁模型 + 图表 |
docs/Report_Final.pdf | 最终报告(57+ 页) |
exploit/PoC.py | 漏洞利用概念验证 |
tests/ | 自动化测试集(pytest) |
reports/Findings.xlsx | 安全审查发现表 |
presentation/ | 演示幻灯片和视频 |
| 组件 | 版本 | 用途 |
|---|
cd kaspersky_task_SushinIvan
# 构建镜像
docker build -t cveanalysis:1.0 .
# 检查镜像
docker images | grep cveanalysis
# 启动容器
docker run -it --rm --privileged -v $(pwd):/work cveanalysis:1.0
cd /work/src/vulnerable-code/build
# 清除缓存
rm -rf CMakeCache.txt CMakeFiles/
# 配置
cmake .. -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug \
-DUSE_ATTR_IFUNC=OFF -DENABLE_NLS=OFF
# 构建
make -j$(nproc)
# 检查版本
./xz --version
# 预期输出:xz (XZ Utils) 5.6.1
cd /work/src/patched-code/build
# 清除缓存
rm -rf CMakeCache.txt CMakeFiles/
# 配置
cmake .. -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug \
-DUSE_ATTR_IFUNC=OFF -DENABLE_NLS=OFF
# 构建
make -j$(nproc)
# 检查版本
./xz --version
# 预期输出:xz (XZ Utils) 5.6.2
cd /work/src/vulnerable-code/build
# 构建
make -j$(nproc)
# 运行项目测试
make test
# 预期结果:All tests passed
# 安装依赖
cd /work
pip3 install -r tests/requirements.txt
# 运行 pytest
python3 -m pytest tests/ -v
预期结果:5 passed
静态分析
# 符号分析(nm)
nm -C liblzma.a | grep -iE "ssh|backdoor|hook|init"
# Cppcheck
cppcheck --enable=all --inconclusive src/liblzma 2> reports/cppcheck_log.txt
动态分析
# AddressSanitizer(带标志构建)
cmake .. -DCMAKE_C_FLAGS="-fsanitize=address -g"
# Valgrind
valgrind --leak-check=full ./exploit/test_trigger
# AFL++ 模糊测试(30分钟)
timeout 1800 afl-fuzz -i fuzzing/inputs -o fuzzing/outputs -- ./exploit/test_trigger_afl @@
.
├── Dockerfile # Docker 镜像
├── README.md # 本文件
├── Report_Final.pdf # 最终报告
├── docs/
│ ├── ThreatModel.md # 威胁模型
│ └── threat_model.png # 图表
├── exploit/
│ ├── PoC.py # 概念验证
│ ├── test_trigger.c # ASAN/AFL++ 测试
│ ├── test_trigger # 二进制文件
│ └── test_trigger_afl # 插桩后的二进制文件
├── tests/
│ ├── src/
│ │ └── test_cve2024_3094.py # 自动测试
│ ├── CMakeLists.txt # 测试配置
│ └── requirements.txt # Python 依赖
├── reports/
│ ├── Findings.xlsx # 发现表
│ ├── asan_test_output.txt # ASAN 日志
│ ├── valgrind_log.txt # Valgrind 日志
│ ├── cppcheck_log.txt # Cppcheck 日志
│ ├── afl_fuzzing_log.txt # AFL++ 日志
│ └── version_*.txt # 构建版本
└── presentation/
└── slides.md # 演示幻灯片
| Docker Engine | 20.10+ | 环境容器化 |
| Git | 2.20+ | 版本控制 |
| Python | 3.8+ | 测试和脚本 |
| GCC/Clang | 9.0+ | 编译 XZ Utils |