coverage-guided-fuzzing
Overview
Coverage-guided fuzzers mutate inputs, watch which code paths each input
reaches, and keep mutating the inputs that find new coverage. Every
mainstream engine implements the same loop; they differ in language,
process model, and toolchain integration. This umbrella covers choosing
the engine, the engine-generic workflow (target → corpus → sanitizers →
CI), and links the per-engine references that carry exact flags and
harness syntax.
| Engine |
Language / niche |
Reference |
| libFuzzer |
C/C++ callable APIs, in-process (also Swift) |
references/libfuzzer.md |
| AFL++ |
File/stdin-driven binaries, closed-source via QEMU |
references/afl-plus-plus.md |
| cargo-fuzz |
Rust crates (libFuzzer + cargo, nightly) |
references/cargo-fuzz.md |
| Go native |
Go packages (go test -fuzz, Go 1.18+) |
references/go-native-fuzzing.md |
| Atheris |
Python libraries + CPython extensions |
references/atheris.md |
| Jazzer |
Java / Kotlin / Scala / Groovy (@FuzzTest) |
references/jazzer.md |
Shared catalogs:
references/corpus-management.md
(seed / evolved corpus, dictionaries, minimisation) and
references/sanitizer-integration.md
(ASan / UBSan / MSan / TSan / LSan flags + compatibility).
When to use
- A project needs coverage-guided fuzzing and no fuzzer has been chosen
for its language or toolchain yet (routing below).
- Authoring a fuzz target, bootstrapping its corpus, or picking
sanitizers for it.
- Running or maintaining a fuzz campaign - local, CI smoke, or
long-running.
- Reviewing an existing fuzz target - verify the right engine was
selected.
Choosing your fuzzer
Step 1: Identify target language(s).
↓
+-------+----------+--------+--------+-------+--------+--------+
| C/C++ | Rust | Go | Python | JVM | Other | Binary |
| | | | | | | (no |
| | | | | | | source)|
+-------+----------+--------+--------+-------+--------+--------+
↓ ↓ ↓ ↓ ↓ ↓ ↓
Step 2: AFL++
Library cargo- go test Atheris Jazzer Choose -Q mode
function? fuzz -fuzz per LLVM
YES -fsanitize
↓ support
libFuzzer
(in-process)
OR
AFL++ (file-driven)
| Target characteristic |
Route to |
| C / C++ library with callable function API |
libFuzzer |
| C / C++ binary processing files |
AFL++ |
| C / C++ source unavailable |
AFL++ (-Q QEMU) |
| Rust crate |
cargo-fuzz |
| Rust binary processing files |
AFL++ |
| Go package |
Go native fuzzing |
| Pure Python or CPython native extension |
Atheris |
| Java / Kotlin / Scala / Groovy library |
Jazzer |
| Swift library |
libFuzzer (Swift wraps libFuzzer natively) |
Routing rationale:
- C/C++: prefer libFuzzer for callable APIs (parsers, validators,
decoders) - in-process iteration is 10-100x faster. Switch to AFL++
when the target reads stdin/file input, when you need QEMU mode for
closed-source binaries, or as a second mutation engine (AFL++ and
libFuzzer find different bugs); mature projects run both.
- Rust: cargo-fuzz integrates with cargo and supports
Arbitrary
for structured input; requires nightly. Rust binaries (not callable
APIs) → AFL++.
- Go: native fuzzing is built into
testing (Go 1.18+); failing
inputs auto-save as regression fixtures. CGo dependencies → AFL++ -Q.
- Python: Atheris (Google's libFuzzer-backed fuzzer) covers pure
Python and CPython extensions. For property-based testing without
coverage guidance, Hypothesis (
hypothesis-testing, qa-property-based
plugin) is complementary, not competing.
- JVM: Jazzer integrates with JUnit 5 via
@FuzzTest and ships
JVM-level sanitizers (deserialization, SSRF, ReDoS, command injection).
- Other languages: with libFuzzer-compatible sanitizer-coverage
support (Swift, Objective-C) use libFuzzer via FFI; without it
(Erlang, OCaml), fuzz the compiled binary with AFL++.
- OSS overlay: mature, security-relevant open-source projects can
additionally onboard to OSS-Fuzz
(google.github.io/oss-fuzz) -
it runs existing libFuzzer / AFL++ / Jazzer harnesses 24x7.
The engine-generic workflow
Step 1 - Write a small, deterministic fuzz target
Every engine calls your target repeatedly with mutated bytes (or typed
values). The rules are engine-independent:
- Keep the target small - one function / one format per target; faster
iteration, clearer coverage attribution.
- No global state between runs - cross-input contamination defeats
coverage guidance.
- Use the full input; don't gate on arbitrary size checks.
- No I/O or network in the hot path.
- For multi-parameter targets use the engine's structured-input helper:
FuzzedDataProvider (libFuzzer / Atheris / Jazzer), Arbitrary
(cargo-fuzz), typed f.Fuzz parameters (Go).
Exact harness syntax per engine is in the reference files.
Step 2 - Seed corpus + dictionary
Bootstrap with 5-50 hand-curated diverse inputs (from spec keywords,
test fixtures, or PII-scrubbed production samples) and, for structured
formats (JSON / XML / SQL / protobuf), a dictionary of grammar tokens -
without one the fuzzer slowly rediscovers the grammar. Keep seeds
versioned and read-only; let the evolved corpus live in the output
directory (CI cache, not the repo). Construction strategies, per-engine
directory layouts, and minimisation cadence:
references/corpus-management.md.
Step 3 - Sanitizers
A fuzzer without sanitizers catches only hard crashes - 80%+ of memory
bugs are silent without them. Defaults per language:
- C/C++ / Rust: ASan + UBSan in one binary
(
-fsanitize=fuzzer,address,undefined -fno-sanitize-recover=all);
MSan needs a separate whole-program-instrumented binary.
- Go: the race detector (
go test -race) is the TSan-equivalent.
- JVM: Jazzer's JVM-level sanitizers are on by default.
- Python: attach ASan to the interpreter only when fuzzing native
extensions.
Compatibility matrix, build flags, ASAN_OPTIONS / UBSAN_OPTIONS, and
report anatomy:
references/sanitizer-integration.md.
Step 4 - Run, minimise, repeat
Run locally until coverage plateaus; minimise the corpus periodically
(-merge=1 / afl-cmin) so cycle time stays flat; minimise every crash
input before filing it. Crash artifacts (crash-<sha1> etc.) and their
handling are cataloged in
references/corpus-management.md;
classification and exploitability rules live in references/crash-triage.md.
Step 5 - CI wiring
CI runs a short smoke fuzz (3-5 min per target) on every PR; long
campaigns run outside CI. The engine-generic shape:
- uses: actions/cache@v4 # evolved corpus accumulates across runs
with:
path: fuzz/corpus
key: fuzz-corpus-${{ github.sha }}
restore-keys: fuzz-corpus-
- name: Smoke fuzz (5 min)
run: ./fuzz_target -max_total_time=300 fuzz/corpus fuzz/seeds
- uses: actions/upload-artifact@v4
if: always()
with: { name: fuzz-crashes, path: "crash-* leak-* timeout-* oom-*" }
Complete per-engine CI jobs (AFL++ Docker, cargo-fuzz nightly matrix, Go
target loop, Jazzer JAZZER_FUZZ, Atheris) are in each engine's
reference file.
Anti-patterns
| Anti-pattern |
Why it fails |
Fix |
| Picking AFL++ for a callable C/C++ library API |
Out-of-process overhead 10-100x |
libFuzzer for in-process |
| Picking libFuzzer for a file-processing binary |
Adapter glue is complex; AFL++ handles @@ cleanly |
AFL++ |
| Picking cargo-fuzz on stable Rust |
Won't compile |
Nightly toolchain |
| Fuzzing without sanitizers |
Catches only crashes; most bugs silent |
Step 3 defaults |
| No seed corpus / no dictionary for structured formats |
Fuzzer wanders; slow path discovery |
Step 2 |
| Never minimising the corpus |
Cycle time degrades; coverage redundant |
Weekly -merge=1 / afl-cmin |
| Mixing fuzzer corpora without conversion |
libFuzzer / AFL++ formats aren't compatible |
One fuzzer's corpus; convert if needed |
| Routing on language alone, ignoring source availability |
Closed-source needs QEMU regardless |
Factor in availability |
Limitations
- Per-engine depth lives in the references - flags, harness syntax, and
CI jobs differ per engine.
- Cross-language targets (e.g. JNI) need two campaigns: Jazzer for the
Java side, libFuzzer for the C side.
- Crash triage (classification, dedup, exploitability, verdicts) is
covered in references/crash-triage.md, not
in this file's steps.
References
- references/libfuzzer.md - libFuzzer harness, flags, CI
- references/afl-plus-plus.md - AFL++ build, parallel campaigns, QEMU, afl-tmin/cmin
- references/cargo-fuzz.md - cargo-fuzz init/add/run, Arbitrary, sanitizer variants
- references/go-native-fuzzing.md - FuzzXxx targets, testdata/fuzz, regression auto-save
- references/atheris.md - atheris.Setup, instrument_imports, FuzzedDataProvider
- references/jazzer.md - @FuzzTest, JVM sanitizers, JAZZER_FUZZ modes
- references/corpus-management.md - corpus roles, layouts, dictionaries, minimisation
- references/sanitizer-integration.md - the five sanitizers, compatibility, report reading
- LLVM libFuzzer - llvm.org/docs/LibFuzzer.html
- AFL++ - github.com/AFLplusplus/AFLplusplus
- Go fuzzing - go.dev/doc/security/fuzz
- cargo-fuzz - github.com/rust-fuzz/cargo-fuzz
- Atheris - github.com/google/atheris
- Jazzer - github.com/CodeIntelligenceTesting/jazzer
- references/crash-triage.md - reading + classifying the crashes this workflow produces
1---2name: coverage-guided-fuzzing3description: "Use when a project needs fuzz testing, a fuzz campaign must be written or maintained, or fuzzer crashes need triage. Picks libFuzzer, AFL++, cargo-fuzz, Go fuzzing, Atheris or Jazzer by language, then covers fuzz targets, seed corpora, dictionaries, sanitizers, crash triage and CI smoke fuzzing."4metadata:5 source: https://skillmd.com/skills/testland/coverage-guided-fuzzing6---78# coverage-guided-fuzzing910## Overview1112Coverage-guided fuzzers mutate inputs, watch which code paths each input13reaches, and keep mutating the inputs that find new coverage. Every14mainstream engine implements the same loop; they differ in language,15process model, and toolchain integration. This umbrella covers choosing16the engine, the engine-generic workflow (target → corpus → sanitizers →17CI), and links the per-engine references that carry exact flags and18harness syntax.1920| Engine | Language / niche | Reference |21|---|---|---|22| libFuzzer | C/C++ callable APIs, in-process (also Swift) | [references/libfuzzer.md](references/libfuzzer.md) |23| AFL++ | File/stdin-driven binaries, closed-source via QEMU | [references/afl-plus-plus.md](references/afl-plus-plus.md) |24| cargo-fuzz | Rust crates (libFuzzer + cargo, nightly) | [references/cargo-fuzz.md](references/cargo-fuzz.md) |25| Go native | Go packages (`go test -fuzz`, Go 1.18+) | [references/go-native-fuzzing.md](references/go-native-fuzzing.md) |26| Atheris | Python libraries + CPython extensions | [references/atheris.md](references/atheris.md) |27| Jazzer | Java / Kotlin / Scala / Groovy (`@FuzzTest`) | [references/jazzer.md](references/jazzer.md) |2829Shared catalogs:30[references/corpus-management.md](references/corpus-management.md)31(seed / evolved corpus, dictionaries, minimisation) and32[references/sanitizer-integration.md](references/sanitizer-integration.md)33(ASan / UBSan / MSan / TSan / LSan flags + compatibility).3435## When to use3637- A project needs coverage-guided fuzzing and no fuzzer has been chosen38 for its language or toolchain yet (routing below).39- Authoring a fuzz target, bootstrapping its corpus, or picking40 sanitizers for it.41- Running or maintaining a fuzz campaign - local, CI smoke, or42 long-running.43- Reviewing an existing fuzz target - verify the right engine was44 selected.4546## Choosing your fuzzer4748```49Step 1: Identify target language(s).50 ↓51+-------+----------+--------+--------+-------+--------+--------+52| C/C++ | Rust | Go | Python | JVM | Other | Binary |53| | | | | | | (no |54| | | | | | | source)|55+-------+----------+--------+--------+-------+--------+--------+56 ↓ ↓ ↓ ↓ ↓ ↓ ↓57 Step 2: AFL++58 Library cargo- go test Atheris Jazzer Choose -Q mode59 function? fuzz -fuzz per LLVM60 YES -fsanitize61 ↓ support62 libFuzzer63 (in-process)64 OR65 AFL++ (file-driven)66```6768| Target characteristic | Route to |69|---|---|70| C / C++ library with callable function API | libFuzzer |71| C / C++ binary processing files | AFL++ |72| C / C++ source unavailable | AFL++ (`-Q` QEMU) |73| Rust crate | cargo-fuzz |74| Rust binary processing files | AFL++ |75| Go package | Go native fuzzing |76| Pure Python or CPython native extension | Atheris |77| Java / Kotlin / Scala / Groovy library | Jazzer |78| Swift library | libFuzzer (Swift wraps libFuzzer natively) |7980Routing rationale:8182- **C/C++**: prefer libFuzzer for callable APIs (parsers, validators,83 decoders) - in-process iteration is 10-100x faster. Switch to AFL++84 when the target reads stdin/file input, when you need QEMU mode for85 closed-source binaries, or as a second mutation engine (AFL++ and86 libFuzzer find different bugs); mature projects run both.87- **Rust**: cargo-fuzz integrates with cargo and supports `Arbitrary`88 for structured input; requires nightly. Rust binaries (not callable89 APIs) → AFL++.90- **Go**: native fuzzing is built into `testing` (Go 1.18+); failing91 inputs auto-save as regression fixtures. CGo dependencies → AFL++ `-Q`.92- **Python**: Atheris (Google's libFuzzer-backed fuzzer) covers pure93 Python and CPython extensions. For property-based testing without94 coverage guidance, Hypothesis (`hypothesis-testing`, qa-property-based95 plugin) is complementary, not competing.96- **JVM**: Jazzer integrates with JUnit 5 via `@FuzzTest` and ships97 JVM-level sanitizers (deserialization, SSRF, ReDoS, command injection).98- **Other languages**: with libFuzzer-compatible sanitizer-coverage99 support (Swift, Objective-C) use libFuzzer via FFI; without it100 (Erlang, OCaml), fuzz the compiled binary with AFL++.101- **OSS overlay**: mature, security-relevant open-source projects can102 additionally onboard to OSS-Fuzz103 ([google.github.io/oss-fuzz](https://google.github.io/oss-fuzz/)) -104 it runs existing libFuzzer / AFL++ / Jazzer harnesses 24x7.105106## The engine-generic workflow107108### Step 1 - Write a small, deterministic fuzz target109110Every engine calls your target repeatedly with mutated bytes (or typed111values). The rules are engine-independent:112113- Keep the target small - one function / one format per target; faster114 iteration, clearer coverage attribution.115- No global state between runs - cross-input contamination defeats116 coverage guidance.117- Use the full input; don't gate on arbitrary size checks.118- No I/O or network in the hot path.119- For multi-parameter targets use the engine's structured-input helper:120 `FuzzedDataProvider` (libFuzzer / Atheris / Jazzer), `Arbitrary`121 (cargo-fuzz), typed `f.Fuzz` parameters (Go).122123Exact harness syntax per engine is in the reference files.124125### Step 2 - Seed corpus + dictionary126127Bootstrap with 5-50 hand-curated diverse inputs (from spec keywords,128test fixtures, or PII-scrubbed production samples) and, for structured129formats (JSON / XML / SQL / protobuf), a dictionary of grammar tokens -130without one the fuzzer slowly rediscovers the grammar. Keep seeds131versioned and read-only; let the evolved corpus live in the output132directory (CI cache, not the repo). Construction strategies, per-engine133directory layouts, and minimisation cadence:134[references/corpus-management.md](references/corpus-management.md).135136### Step 3 - Sanitizers137138A fuzzer without sanitizers catches only hard crashes - 80%+ of memory139bugs are silent without them. Defaults per language:140141- C/C++ / Rust: ASan + UBSan in one binary142 (`-fsanitize=fuzzer,address,undefined -fno-sanitize-recover=all`);143 MSan needs a separate whole-program-instrumented binary.144- Go: the race detector (`go test -race`) is the TSan-equivalent.145- JVM: Jazzer's JVM-level sanitizers are on by default.146- Python: attach ASan to the interpreter only when fuzzing native147 extensions.148149Compatibility matrix, build flags, `ASAN_OPTIONS` / `UBSAN_OPTIONS`, and150report anatomy:151[references/sanitizer-integration.md](references/sanitizer-integration.md).152153### Step 4 - Run, minimise, repeat154155Run locally until coverage plateaus; minimise the corpus periodically156(`-merge=1` / `afl-cmin`) so cycle time stays flat; minimise every crash157input before filing it. Crash artifacts (`crash-<sha1>` etc.) and their158handling are cataloged in159[references/corpus-management.md](references/corpus-management.md);160classification and exploitability rules live in [references/crash-triage.md](references/crash-triage.md).161162### Step 5 - CI wiring163164CI runs a short smoke fuzz (3-5 min per target) on every PR; long165campaigns run outside CI. The engine-generic shape:166167```yaml168 - uses: actions/cache@v4 # evolved corpus accumulates across runs169 with:170 path: fuzz/corpus171 key: fuzz-corpus-${{ github.sha }}172 restore-keys: fuzz-corpus-173 - name: Smoke fuzz (5 min)174 run: ./fuzz_target -max_total_time=300 fuzz/corpus fuzz/seeds175 - uses: actions/upload-artifact@v4176 if: always()177 with: { name: fuzz-crashes, path: "crash-* leak-* timeout-* oom-*" }178```179180Complete per-engine CI jobs (AFL++ Docker, cargo-fuzz nightly matrix, Go181target loop, Jazzer `JAZZER_FUZZ`, Atheris) are in each engine's182reference file.183184## Anti-patterns185186| Anti-pattern | Why it fails | Fix |187|---|---|---|188| Picking AFL++ for a callable C/C++ library API | Out-of-process overhead 10-100x | libFuzzer for in-process |189| Picking libFuzzer for a file-processing binary | Adapter glue is complex; AFL++ handles `@@` cleanly | AFL++ |190| Picking cargo-fuzz on stable Rust | Won't compile | Nightly toolchain |191| Fuzzing without sanitizers | Catches only crashes; most bugs silent | Step 3 defaults |192| No seed corpus / no dictionary for structured formats | Fuzzer wanders; slow path discovery | Step 2 |193| Never minimising the corpus | Cycle time degrades; coverage redundant | Weekly `-merge=1` / `afl-cmin` |194| Mixing fuzzer corpora without conversion | libFuzzer / AFL++ formats aren't compatible | One fuzzer's corpus; convert if needed |195| Routing on language alone, ignoring source availability | Closed-source needs QEMU regardless | Factor in availability |196197## Limitations198199- Per-engine depth lives in the references - flags, harness syntax, and200 CI jobs differ per engine.201- Cross-language targets (e.g. JNI) need two campaigns: Jazzer for the202 Java side, libFuzzer for the C side.203- Crash triage (classification, dedup, exploitability, verdicts) is204 covered in [references/crash-triage.md](references/crash-triage.md), not205 in this file's steps.206207## References208209- [references/libfuzzer.md](references/libfuzzer.md) - libFuzzer harness, flags, CI210- [references/afl-plus-plus.md](references/afl-plus-plus.md) - AFL++ build, parallel campaigns, QEMU, afl-tmin/cmin211- [references/cargo-fuzz.md](references/cargo-fuzz.md) - cargo-fuzz init/add/run, Arbitrary, sanitizer variants212- [references/go-native-fuzzing.md](references/go-native-fuzzing.md) - FuzzXxx targets, testdata/fuzz, regression auto-save213- [references/atheris.md](references/atheris.md) - atheris.Setup, instrument_imports, FuzzedDataProvider214- [references/jazzer.md](references/jazzer.md) - @FuzzTest, JVM sanitizers, JAZZER_FUZZ modes215- [references/corpus-management.md](references/corpus-management.md) - corpus roles, layouts, dictionaries, minimisation216- [references/sanitizer-integration.md](references/sanitizer-integration.md) - the five sanitizers, compatibility, report reading217- LLVM libFuzzer - [llvm.org/docs/LibFuzzer.html](https://llvm.org/docs/LibFuzzer.html)218- AFL++ - [github.com/AFLplusplus/AFLplusplus](https://github.com/AFLplusplus/AFLplusplus)219- Go fuzzing - [go.dev/doc/security/fuzz](https://go.dev/doc/security/fuzz)220- cargo-fuzz - [github.com/rust-fuzz/cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz)221- Atheris - [github.com/google/atheris](https://github.com/google/atheris)222- Jazzer - [github.com/CodeIntelligenceTesting/jazzer](https://github.com/CodeIntelligenceTesting/jazzer)223- [references/crash-triage.md](references/crash-triage.md) - reading + classifying the crashes this workflow produces