FuzzAnything/PromptFuzz

GitHub: FuzzAnything/PromptFuzz

通过对 LLM prompt 进行变异来自动生成高质量 fuzz driver,帮助安全测试人员高效发现 C/C++ 库中的安全漏洞。

Stars: 339 | Forks: 41

# 用于生成 Fuzz Driver 的 Prompt Fuzzing PromptFuzz 是一款自动化工具,它通过对 LLM 的 prompt 进行变异来构建 fuzz 循环,从而为库生成高质量的 fuzz driver。PromptFuzz 的 fuzz 循环旨在引导 LLM prompt 的变异,生成能够覆盖更多可达代码并探索复杂 API 相互关系的程序,这对于 fuzz 非常有效。 ![workflow](https://static.pigsec.cn/wp-content/uploads/repos/cas/65/650c8e6ac3ec31f7df92b662611ee7ad66e91d39badd138dff0a48b4b8d3129a.png) PromptFuzz 目前被视为学术界和工业界生成 fuzz driver 的领先方案。**PromptFuzz 生成的 fuzz driver 在测试库上实现了 40.12\% 的分支覆盖率**,比 *[OSS-Fuzz](https://github.com/google/oss-fuzz)* 高出 1.61 倍,比 *[Hopper](https://arxiv.org/pdf/2309.03496)* 高出 1.67 倍。此外,PromptFuzz 从 49 个独立崩溃中检测出了 33 个有效的安全 bug。 ![workflow](https://static.pigsec.cn/wp-content/uploads/repos/cas/1c/1c9ac0679197864a1f11af41d6ce862d293b2df22117a30b2b44f1067a0a816a.png) ## 发布说明: - 发布 [v1.0.0](https://github.com/FuzzAnything/PromptFuzz/releases/tag/v1.0.0)。支持 [AFLPlusPlus](AFLPlusPlus.md)、更多库,并修复了许多 panic bug!(2026-04-10) - 将 **Clang** 和 **LLVM** 版本升级至 18!(2025-06-07) - 将 **async_openai** sdk 版本升级至 0.28,以支持 OPENAI 接口的新特性。(2025-06-05) - 支持 **OpenAI 规范**!您可以通过标准的 OPENAI 规范使用任何 LLM。(2025-05-02) ## ✨功能 - **多 LLM 支持**:通过 OPENAI 接口规范支持调用任何 LLM! - **基于上下文的 Prompt**:利用自动提取的库上下文构建 LLM prompt。 - **强大的清洗机制**:对程序的语法、语义、行为和覆盖率进行深入分析,以清洗掉有问题的程序。 - **优先变异**:在代码覆盖率的引导下,优先变异 LLM prompt 中的库 API 组合,以探索复杂的相互关系。 - **Fuzz Driver 利用**:利用统计推断 API 约束,并扩展固定的 API 参数以接收来自 fuzzer 的随机字节。 - **Fuzz 引擎集成**:与 grey-box fuzz 引擎 LibFuzzer 集成。 ## 🏆荣誉 PromptFuzz 生成的 fuzz driver 可以检测出种类繁多的 bug,其中大部分是安全 bug。例如:[CVE-2023-6277](https://nvd.nist.gov/vuln/detail/CVE-2023-6277)、[CVE-2023-52355](https://nvd.nist.gov/vuln/detail/CVE-2023-52355) 和 [CVE-2023-52356](https://nvd.nist.gov/vuln/detail/CVE-2023-52356)。 PromptFuzz 独家发现的有趣 bug: | ID | **库** | **存在 Bug 的函数** | **Bug 类型** | **状态** | **追踪链接** | |-------------|------------------|-----------------------------------------|-------------------|-----------------|-------------------| | 1. | libaom | highbd_8_variance_sse2 | SEGV | 已确认 | [3489](https://bugs.chromium.org/p/aomedia/issues/detail?id=3489) | | 2. | libaom | av1_rc_update_framerate | 栈变量未初始化 | 已确认 | [3509](https://bugs.chromium.org/p/aomedia/issues/detail?id=3509) | | 3. | libaom | timebase_units_to_ticks | 整数溢出 | 已确认 | [3510](https://bugs.chromium.org/p/aomedia/issues/detail?id=3510) | | 4. | libaom | encode_without_recode | SEGV | 已确认 | [3534](https://bugs.chromium.org/p/aomedia/issues/detail?id=3534) | | 5. | libvpx | vp8_peek_si_internal | SEGV | 已确认 | [1817](https://bugs.chromium.org/p/webm/issues/detail?id=1817) | | 6. | libvpx | update_fragments | 缓冲区溢出 | 已确认 | [1827](https://bugs.chromium.org/p/webm/issues/detail?id=1827) | | 7. | libvpx | vp8e_encode | 整数溢出 | 已确认 | [1828](https://bugs.chromium.org/p/webm/issues/detail?id=1828) | | 8. | libvpx | encode_mb_row | 整数溢出 | 已确认 | [1831](https://bugs.chromium.org/p/webm/issues/detail?id=1831) | | 9. | libvpx | vpx_free_tpl_gop_stats | SEGV | 已确认 | [1837](https://bugs.chromium.org/p/webm/issues/detail?id=1837) | | | 10. | libmagic | mkdbname | 缓冲区溢出 | 已确认 | [481](https://bugs.astron.com/view.php?id=481) | | 11. | libmagic | magic_setparam | 缓冲区溢出 | 等待中 | [482](https://bugs.astron.com/view.php?id=482) | | 12. | libmagic | check_buffer | 缓冲区溢出 | 已确认 | [483](https://bugs.astron.com/view.php?id=483) | | 13. | libmagic | mget | 整数溢出 | 等待中 | [486](https://bugs.astron.com/view.php?id=486) | | 14. | libTIFF | TIFFOpen | OOM | 已确认 | [614](https://gitlab.com/libtiff/libtiff/-/issues/614) | | 15. | libTIFF | PixarLogSetupDecode | OOM | 已确认 | [619](https://gitlab.com/libtiff/libtiff/-/issues/619) | | 16. | libTIFF | TIFFReadEncodedStrip | OOM | 已确认 | [620](https://gitlab.com/libtiff/libtiff/-/issues/620) | | 17. | libTIFF | TIFFReadRGBAImageOriented | OOM | 已确认 | [620](https://gitlab.com/libtiff/libtiff/-/issues/620) | | 18. | libTIFF | TIFFRasterScanlineSize64 | OOM | 已确认 | [621](https://gitlab.com/libtiff/libtiff/-/issues/621) | | 19. | libTIFF | TIFFReadRGBATileExt | SEGV | 已确认 | [622](https://gitlab.com/libtiff/libtiff/-/issues/622) | | 20. | sqlite3 | sqlite3_unlock_notify | 空指针崩溃 | 已确认 | [e77a5](https://www.sqlite.org/forum/forumpost/e77a5c3445) | | 21. | sqlite3 | sqlite3_enable_load_extension | 空指针崩溃 | 已确认 | [9ce83](https://www.sqlite.org/forum/forumpost/9ce835fe96) | | 22. | sqlite3 | sqlite3_db_config | 空指针崩溃 | 已确认 | [5e3fc](https://www.sqlite.org/forum/forumpost/5e3fc453a6) | | 23. | c-ares | config_sortlist | 内存泄漏 | 已确认 | [d62627](https://github.com/c-ares/c-ares/commit/d62627e8b39ef793c3b1c7b054724b0d581eb4fb) | | 24. | c-ares | config_sortlist | 内存泄漏 | 已确认 | [d62627](https://github.com/c-ares/c-ares/commit/d62627e8b39ef793c3b1c7b054724b0d581eb4fb) | | 25. | libjpeg-turbo | tj3DecodeYUV8 | 整数溢出 | 已确认 | [78eaf0](https://github.com/libjpeg-turbo/libjpeg-turbo/security/advisories/GHSA-x7cp-qgf3-9896) | | 26. | libjpeg-turbo | tj3LoadImage16 | OOM | 已确认 | [735](https://github.com/libjpeg-turbo/libjpeg-turbo/issues/735) | | 27. | libpcap | pcap_create | 文件泄漏 | 已确认 | [1233](https://github.com/the-tcpdump-group/libpcap/issues/1233) | | 28. | libpcap | pcapint_create_interface | 空指针崩溃 | 已确认 | [1239](https://github.com/the-tcpdump-group/libpcap/issues/1239) | | 29. | libpcap | pcapint_fixup_pcap_pkthdr | 地址未对齐 | 已确认 | - | | | 30. | cJSON | cJSON_SetNumberHelper | 错误转换 | 已确认 | [805](https://github.com/DaveGamble/cJSON/issues/805) | | 31. | cJSON | cJSON_CreateNumber | 错误转换 | 已确认 | [806](https://github.com/DaveGamble/cJSON/issues/806) | | 32. | cJSON | cJSON_DeleteItemFromObjectCaseSensitive | 超时 | 已确认 | [807](https://github.com/DaveGamble/cJSON/issues/807) | | 33. | curl | parseurl | 断言失败 | 已确认 | [12775](https://github.com/curl/curl/pull/12775) | # 用法 请参阅 [用法](USAGE.md) ## 故障排除 PromptFuzz 对生成的 harness 进行了静态和动态分析定制,以确保 harness 的有效性和 bug 检测的准确性。由于 LLM 能够生成多样的 C 和 C++ 语法,我们预定义的分析在遇到某些极端情况时可能会发生 panic。如果您遇到此类情况,请使用 `RUST_BACKTRACE=1` 复现该问题并提交报告。如果可能的话,请让您的编码助手(使用功能强大的 LLM)尝试找出问题并进行修复。欢迎提交 PR。 ## 🎈未来工作 - **闭源库:** 通过在私有代码语料库上 fine-tuning LLM,将 PromptFuzz 应用于闭源库。 - **泛化**:将 PromptFuzz 推广到二进制程序。
标签:AI编程, DLL 劫持, 代码生成, 可视化界面, 大语言模型, 渗透测试工具, 通知系统