seikaikyo/dash-skills/libfuzzer
- community
Checking that the SKILL.md file is still in the repository.
Sets up and runs libFuzzer, the coverage-guided fuzzer built into LLVM, on C/C++ code that compiles with Clang. Covers harness structure, -fsanitize=fuzzer builds, corpus and dictionary management, sanitizer integration, and campaign triage. Use when writing or debugging an LLVMFuzzerTestOneInput harness, starting fuzzing on a C/C++ library, choosing between libFuzzer and AFL++, or working out why a libFuzzer run finds nothing.
Install
npx vskill@latest install seikaikyo/dash-skills/libfuzzerSKILL.md
libFuzzer
libFuzzer is an in-process, coverage-guided fuzzer that is part of the LLVM project. It's the recommended starting point for fuzzing C/C++ projects due to its simplicity and integration with the LLVM toolchain. While libFuzzer has been in maintenance-only mode since late 2022, it is easier to install and use than its alternatives, has wide support, and will be maintained for the foreseeable future.
When to Use
| Fuzzer | Best For | Complexity | |
|---|---|---|---|
| libFuzzer | Quick setup, single-project fuzzing | Low | |
| AFL++ | Multi-core fuzzing, diverse mutations | Medium | |
| LibAFL | Custom fuzzers, research projects | High | |
| Honggfuzz | Hardware-based coverage | Medium |
Choose libFuzzer when:
- You need a simple, quick setup for C/C++ code
- Project uses Clang for compilation
- Single-core fuzzing is sufficient initially
- Transitioning to AFL++ later is an option (harnesses are compatible)
Note: Fuzzing harnesses written for libFuzzer are compatible with AFL++, making it easy to transition if you need more advanced features like better multi-core support.
Quick Start
Compile and run:
Installation
Prerequisites
- LLVM/Clang compiler (includes libFuzzer)
- LLVM tools for coverage analysis (optional)
Linux (Ubuntu/Debian)
For the latest LLVM version:
macOS
Windows
Install Clang through Visual Studio. Refer to Microsoft's documentation for setup instructions.
Recommendation: If possible, fuzz on a local x86_64 VM or rent one on DigitalOcean, AWS, or Hetzner. Linux provides the best support for libFuzzer.
Verification
Writing a Harness
Harness Structure
The harness is the entry point for the fuzzer. libFuzzer calls the LLVMFuzzerTestOneInput function repeatedly with different inputs.
Harness Rules
| Do | Don't | |
|---|---|---|
| Handle all input types (empty, huge, malformed) | Call exit() - stops fuzzing process | |
| Join all threads before returning | Leave threads running | |
| Keep harness fast and simple | Add excessive logging or complexity | |
| Maintain determinism | Use random number generators or read /dev/random | |
| Reset global state between runs | Rely on state from previous executions | |
| Use narrow, focused targets | Mix unrelated data formats (PNG + TCP) in one harness |
Rationale:
- Speed matters: Aim for 100s-1000s executions per second per core
- Reproducibility: Crashes must be reproducible after fuzzing completes
- Isolation: Each execution should be independent
Using FuzzedDataProvider for Complex Inputs
For complex inputs (strings, multiple parameters), use the FuzzedDataProvider helper:
Download FuzzedDataProvider.h from the LLVM repository.
Interleaved Fuzzing
Use a single harness to test multiple related functions:
See Also: For detailed harness writing techniques, patterns for handling complex inputs,structure-aware fuzzing, and protobuf-based fuzzing, see the fuzz-harness-writing technique skill.
Compilation
Basic Compilation
The key flag is -fsanitize=fuzzer, which:
- Links the libFuzzer runtime (provides
mainfunction) - Enables SanitizerCoverage instrumentation for coverage tracking
- Disables built-in functions like
memcmp
Flags explained:
-fsanitize=fuzzer: Enable libFuzzer-g: Add debug symbols (helpful for crash analysis)-O2: Production-level optimizations (recommended for fuzzing)-DNO_MAIN: Define macro if your code has amainfunction
With Sanitizers
AddressSanitizer (recommended):
Multiple sanitizers:
See Also: For detailed sanitizer configuration, common issues, ASAN_OPTIONS flags,and advanced sanitizer usage, see the address-sanitizer and undefined-behavior-sanitizertechnique skills.
Build Flags
| Flag | Purpose | |
|---|---|---|
-fsanitize=fuzzer | Enable libFuzzer runtime and instrumentation | |
-fsanitize=address | Enable AddressSanitizer (memory error detection) | |
-fsanitize=undefined | Enable UndefinedBehaviorSanitizer | |
-fsanitize=fuzzer-no-link | Instrument without linking fuzzer (for libraries) | |
-g | Include debug symbols | |
-O2 | Production optimization level | |
-U_FORTIFY_SOURCE | Disable fortification (can interfere with ASan) |
Building Static Libraries
For projects that produce static libraries:
- Build the library with fuzzing instrumentation:
- Link the static library with your harness:
CMake Integration
Build with:
Corpus Management
Creating Initial Corpus
Create a directory for the corpus (can start empty):
Optional but recommended: Provide seed inputs (valid example files):
Benefits of seed inputs:
- Fuzzer doesn't start from scratch
- Reaches valid code paths faster
- Significantly improves effectiveness
Corpus Structure
The corpus directory contains:
- Input files that trigger unique code paths
- Minimized versions (libFuzzer automatically minimizes)
- Named by content hash (e.g.,
a9993e364706816aba3e25717850c26c9cd0d89d)
Corpus Minimization
libFuzzer automatically minimizes corpus entries during fuzzing. To explicitly minimize:
This creates a deduplicated, minimized corpus in minimized_corpus/.
See Also: For corpus creation strategies, seed selection, format-specific corpus building,and corpus maintenance, see the fuzzing-corpus technique skill.
Running Campaigns
Basic Run
This runs until a crash is found or you stop it (Ctrl+C).
Recommended: Continue After Crashes
The -fork and -ignore_crashes flags (experimental but widely used) allow fuzzing to continue after finding crashes.
Common Options
Control input size:
Rule of thumb: 2x the size of minimal realistic input.
Set timeout:
Abort test cases that run longer than 2 seconds.
Use a dictionary:
Close stdout/stderr (speed up fuzzing):
See all options:
Multi-Core Fuzzing
Option 1: Jobs and workers (recommended):
-jobs=4: Run 4 sequential campaigns-workers=4: Process jobs in parallel with 4 processes- Test cases are shared between jobs
Option 2: Fork mode:
Note: For serious multi-core fuzzing, consider switching to AFL++, Honggfuzz, or LibAFL.
Re-executing Test Cases
Re-run a single crash:
Test all inputs in a directory without fuzzing:
Interpreting Output
When fuzzing runs, you'll see statistics like:
| Output | Meaning | |
|---|---|---|
INITED | Fuzzing initialized | |
NEW | New coverage found, added to corpus | |
REDUCE | Input minimized while keeping coverage | |
cov: N | Number of coverage edges hit | |
corp: X/Yb | Corpus size: X entries, Y total bytes | |
exec/s: N | Executions per second | |
rss: NMb | Resident memory usage |
On crash:
The crash is saved to ./crash-<hash> with the input shown in hex, UTF-8, and Base64.
Reproducibility: Use -seed=<value> to reproduce a fuzzing campaign (single-core only).
Fuzzing Dictionary
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingexternal/trailofbits-security/testing-handbook-skills/skills/libfuzzer/SKILL.md
Popularity
- Repository stars
- 2
- 7-day trend score
- 5
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/seikaikyo/dash-skills/libfuzzer)