本技能用于覆盖率引导模糊测试,主力工具为 AFL++,备选 libFuzzer 与 honggfuzz,配套 afl-cov 统计覆盖率。适用目标需有明确输入面(文件解析、库函数、网络协议解析),最好有源码可插桩;无源码可用 QEMU 模式。无输入解析、仅需分析已有崩溃、内核/驱动等场景不适用。
安装:Debian/Ubuntu 用 sudo apt install afl++;Fedora 用 sudo dnf install american-fuzzy-lop american-fuzzy-lop-clang;Arch 用 sudo pacman -S afl++;macOS 用 brew install afl++;Windows 走 WSL2。源码编译:git clone https://github.com/AFLplusplus/AFLplusplus && cd AFLplusplus,make distrib,sudo make install。验证 afl-fuzz -h。libFuzzer 随 clang 提供,用 -fsanitize=fuzzer 启用。honggfuzz 部分平台需源码编译。afl-cov 需 git clone https://github.com/mrash/afl-cov,目标需用 gcov 插桩单独编译。
用法:源码目标用 CC=afl-clang-fast AFL_USE_ASAN=1 编译;库函数写 harness(LLVMFuzzerTestOneInput)后编译;语料先 afl-cmin 去重;运行 afl-fuzz -i in_min -o out -m none -t 1000+ -x dict.txt -- ./target @@;多核用 -M/-S,续跑用 -i -。
注意事项:fuzz 属动态执行,应在沙箱内进行;需验证插桩生效;ASAN 配 -m none;崩溃文件交后续去重分析。资料未提供具体价格与平台支持细节。