Skip to content

Repository files navigation

Prompt Fuzzing for Fuzz Driver Generation

PromptFuzz is an automated tool that generates high-quality fuzz drivers for libraries via a fuzz loop constructed on mutating LLMs' prompts. The fuzz loop of PromptFuzz aims to guide the mutation of LLMs' prompts to generate programs that cover more reachable code and explore complex API interrelationships, which are effective for fuzzing.

workflow

PromptFuzz is currently regarded as the leading approach for generating fuzz drivers both in academia and industry. The fuzz drivers generated by PromptFuzz achieved a branch coverage of 40.12% on the tested libraries, which is 1.61x greater than OSS-Fuzz and 1.67x greater than Hopper. Besides, PromptFuzz detected 33 valid security bugs from 49 unique crashes. workflow

Relase Notes:

  • Release v1.0.0. Support AFLPlusPlus, more libraries and fixed many panic bugs! (2026-04-10)
  • Upgrade Clang and LLVM versions to 18! (2025-06-07)
  • Upgrade async_openai sdk version to 0.28 to support OPENAI interface new features. (2025-06-05)
  • Support OpenAI specification! You can use any LLMs via the standard OPENAI specification. (2025-05-02)

✨Features

  • Multiply LLM support: Supports any LLM invocation via the OPENAI Interface Specificatio!.
  • Context-based Prompt: Construct LLM prompts with the automatically extracted library context.
  • Powerful Sanitization: The program's syntax, semantics, behavior, and coverage are thoroughly analyzed to sanitize the problematic programs.
  • Prioritized Mutation: Prioritizes mutating the library API combinations within LLM's prompts to explore complex interrelationships, guided by code coverage.
  • Fuzz Driver Exploitation: Infers API constraints using statistics and extends fixed API arguments to receive random bytes from fuzzers.
  • Fuzz engine integration: Integrates with grey-box fuzz engine: LibFuzzer.

🏆Trophy

The fuzz drivers generated by PromptFuzz can detect a wide range of bugs, most of which are security bugs. For instances, CVE-2023-6277, CVE-2023-52355 and CVE-2023-52356.

PromptFuzz detects uniquely interesting bugs:

IDLibraryBuggy FunctionBug TypeStatusTrack Link
1.libaomhighbd_8_variance_sse2SEGVConfirmed3489
2.libaomav1_rc_update_framerateUninitialized StackConfirmed3509
3.libaomtimebase_units_to_ticksInteger OverflowConfirmed3510
4.libaomencode_without_recodeSEGVConfirmed3534
5.libvpxvp8_peek_si_internalSEGVConfirmed1817
6.libvpxupdate_fragmentsBuffer OverflowConfirmed1827
7.libvpxvp8e_encodeInteger OverflowConfirmed1828
8.libvpxencode_mb_rowInteger OverflowConfirmed1831
9.libvpxvpx_free_tpl_gop_statsSEGVConfirmed1837
10.libmagicmkdbnameBuffer OverflowConfirmed481
11.libmagicmagic_setparamBuffer OverflowWaiting482
12.libmagiccheck_bufferBuffer OverflowConfirmed483
13.libmagicmgetInteger OverflowWaiting486
14.libTIFFTIFFOpenOOMConfirmed614
15.libTIFFPixarLogSetupDecodeOOMConfirmed619
16.libTIFFTIFFReadEncodedStripOOMConfirmed620
17.libTIFFTIFFReadRGBAImageOrientedOOMConfirmed620
18.libTIFFTIFFRasterScanlineSize64OOMConfirmed621
19.libTIFFTIFFReadRGBATileExtSEGVConfirmed622
20.sqlite3sqlite3_unlock_notifyNull Pointer crashConfirmede77a5
21.sqlite3sqlite3_enable_load_extensionNull Pointer crashConfirmed9ce83
22.sqlite3sqlite3_db_configNull Pointer crashConfirmed5e3fc
23.c-aresconfig_sortlistMemory LeakConfirmedd62627
24.c-aresconfig_sortlistMemory LeakConfirmedd62627
25.libjpeg-turbotj3DecodeYUV8Integer OverflowConfirmed78eaf0
26.libjpeg-turbotj3LoadImage16OOMConfirmed735
27.libpcappcap_createFile LeakConfirmed1233
28.libpcappcapint_create_interfaceNull Pointer crashConfirmed1239
29.libpcappcapint_fixup_pcap_pkthdrMisaligned AddressConfirmed-
30.cJSONcJSON_SetNumberHelperError CastConfirmed805
31.cJSONcJSON_CreateNumberError CastConfirmed806
32.cJSONcJSON_DeleteItemFromObjectCaseSensitiveTimeOutConfirmed807
33.curlparseurlAssertion FailureConfirmed12775

Usage

See in Usage

Trouble Shooting

PromptFuzz customized both static and dynamic analysis on the generated harnesses to ensure the harness effectiveness and bug detection accuracy. As LLMs can generate a diverse both C and C++ syntax, our predefined analysis could be panic when it encouters some corner cases. If you encountered that cases, please reproduce that issue with RUST_BACKTRACE=1 and report it. If possible, let your coding pilot (using a powerful LLM) try to identifiy the issues and fix them. Welcome PRs.

🎈Future Works

  • Close-source libraries: Apply PromptFuzz to close-source libraries by fine tuning LLMs on private code corpus.
  • Generalization: Generalize PromptFuzz to binary programs.

About

PromtFuzz is an automated tool that generates high-quality fuzz drivers for libraries via a fuzz loop constructed on mutating LLMs' prompts.

Resources

Contributing

Stars

342 stars

Watchers

8 watching

Forks

Releases

Packages

Used by

Contributors

Languages