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

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

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

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

工具目录

分类

查看所有分类
Loading categories
openssl-fuzz — 使用 Mayhem 发现 CVE-2022-3786 (openssl) | Kitploit
工具/GitHubGitHub/whatthefuzz/openssl-fuzz
漏洞分析漏洞利用模糊测试密码学二进制分析学习与教育
GitHubwhatthefuzz/openssl-fuzz

openssl-fuzz

使用 Mayhem 发现 CVE-2022-3786 (openssl)

查看仓库
53年前尚未审核

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

模糊测试 OpenSSL

本仓库有一篇配套博客文章,标题为“使用 Mayhem 发现 CVE-2022-3786 (openssl)”,链接为 https://www.seandeaton.com。

摘要

所有这些都通过随附的 Dockerfile(也发布在 DockerHub 上)为您处理好了。您可以这样运行:

root@kitploit:~
# Build the container
docker build --tag openssl-cve-2022-3768 .
# Or if you just want to pull down the existing one:
TODO
# Ensure that you're in this project's root directory (ie you can see ./output/)
# Mount the ./input/ directory to the containers /input. This is for fuzz input.
# This is Linux specific, Windows I think has %CD% in lieu of $(pwd)?
docker run --interactive --tty --volume $(pwd)/input:/input

容器的入口点就是直接运行 afl,因此您可以立即开始模糊测试。要覆盖此行为,请在 docker run 命令末尾追加 /bin/bash。

获取存在漏洞的版本

包含该漏洞的最后一个提交是 2022 年 11 月 1 日的提交 SHA 3b421ebc64c7b52f1b9feb3812bdc7781c784332。该漏洞在提交 SHA 680e65b94c916af259bfdc2e25f1ab6e0c7a97d6 中被修复。我们可以轻松地用 git 获取存在漏洞的版本:

root@kitploit:~
# Clone the repository.
git clone git://git.openssl.org/openssl.git
# Change into the working directory.
cd openssl
# Detach HEAD from origin to examine the code as it was when it was vulnerable.
git checkout 3b421ebc64c7b52f1b9feb3812bdc7781c784332

编译

为了编译,我们使用 AFL 的 gcc 编译器(因为我用 clang 时一直遇到未定义的引用)。由于缓冲区溢出偏移量很小,我们还想使用地址消毒(ASAN),通过 AFL 的环境变量 AFL_USE_ASAN 启用。考虑到 ASAN 会占用大量内存,我们还需要限制地址空间,可以通过将程序编译为 32 位架构来实现。更多详情见此处。

OpenSSL 的 32 位配置接受 -m32 和 linux-generic32 这两个标志。compile.sh 脚本会为您完成这些操作。

root@kitploit:~
# Configuration
AFL_USE_ASAN=1 CC=afl-gcc-fast CXX=afl-g++-fast ./Configure -m32 linux-generic32
# Make
AFL_USE_ASAN=1 CC=afl-gcc-fast CXX=afl-g++-fast CFLAGS="-m32" CXXFLAGS="-m32" make

根据您系统的资源情况,这可能需要一段时间。编译完成后,我们需要编译我们的测试工具(harness)。这里提供了一个 Makefile。

root@kitploit:~
# Compile the harness.
$ make harness
# Run the harness.
$ ./harness input/seed0.txt
ossl_a2ulabel returned: 1

就这样,您可以开始对 openssl 中的 ossl_a2ulabel 进行模糊测试了。使用 AFL 时,命令大致如下(或者直接使用随附的 run.sh 脚本)。

root@kitploit:~
afl-fuzz -i /input -o /output /harness/harness @@
下载工具