# Coverage-Guided Fuzzing > Greybox fuzzing in which compile-time or runtime instrumentation reports edge coverage back to a mutation engine, and any input that reaches new coverage is kept in the corpus and mutated further. It is the default algorithm behind AFL/AFL++, libFuzzer, honggfuzz, LibAFL and the language-specific engines built on them. ## How it works - **Feedback loop.** The engine mutates a corpus entry, runs it, reads the coverage map, and saves the input if it hit an unseen edge. AFL's original design is an "instrumentation-guided genetic algorithm" over modified edge coverage, with a queue that grows as new states appear ([[raw/github.com/afl-american-fuzzy-lop-a-security-oriented-fuzzer-2926|AFL]]). The Trail of Bits handbook calls mutation-based evolutionary fuzzing the de facto algorithm and defines the vocabulary: SUT, fuzzer, harness, corpus ([[raw/appsec.guide/fuzzing-testing-handbook-appsec-guide-4285|Testing Handbook: Fuzzing]]). - **Instrumentation.** libFuzzer relies on LLVM SanitizerCoverage (`-fsanitize=fuzzer`, or `-fsanitize-coverage=trace-pc-guard` for AFL-style builds) and needs a matching Clang ([[raw/llvm.org/libfuzzer-a-library-for-coverage-guided-fuzz-testing-llvm-2925|libFuzzer]], [[raw/google.github.io/libfuzzer-and-afl-clusterfuzz-2924|ClusterFuzz: libFuzzer and AFL++]]). The coverage callback is hookable: Include Security patched Fuzzilli's `__sanitizer_cov_trace_pc_guard` for JerryScript to also capture `__builtin_return_address(0)` and symbolize each new edge with `__sanitizer_symbolize_pc` ([[raw/blog.includesecurity.com/coverage-guided-fuzzing-extending-instrumentation-to-hunt-down-bugs-fa-2927|Include Security]]). - **Bug oracles = sanitizers.** Coverage finds paths; ASan/UBSan/MSan make memory and UB errors crash. Without them most corruption is silent. Language ports add their own detectors (see below). - **When it fits.** ClusterFuzz's guidance: coverage-guided is ideal for self-contained, deterministic, fast targets (binary format parsers); blackbox fits large, slow or non-deterministic targets with complex input such as browser DOM fuzzers ([[raw/google.github.io/coverage-guided-vs-blackbox-fuzzing-clusterfuzz-2920|ClusterFuzz: coverage-guided vs blackbox]]). ## Techniques / commands ### libFuzzer ```bash clang -g -O1 -fsanitize=fuzzer,address mytarget.c # ASan clang -g -O1 -fsanitize=fuzzer,memory mytarget.c # MSan clang -g -O1 -fsanitize=fuzzer,signed-integer-overflow mytarget.c ./fuzz_config corpus/ -max_len=4096 -jobs=4 -workers=4 ./fuzz_config -merge=1 corpus_min/ corpus/ # corpus minimization ./fuzz_config -minimize_crash=1 -runs=10000 crash-<sha1> ``` Targets implement `LLVMFuzzerTestOneInput` and must be deterministic, fast and tolerant of arbitrary input; `-fork` is the experimental crash-resilient parallel mode ([[raw/llvm.org/libfuzzer-a-library-for-coverage-guided-fuzz-testing-llvm-2925|libFuzzer]], [[raw/binaryexploitation.org/coverage-guided-fuzzing-with-libfuzzer-and-afl-13805|binaryexploitation.org]]). Fork mode itself had a parent-process NULL deref when a feature file is missing or empty ([[raw/github.com/libfuzzer-fork-mode-null-dereference-bug-report-14826|libFuzzer fork-mode bug]]). ### AFL++ - **Compiler choice:** LLVM 11+ → `afl-clang-lto` (LTO mode); otherwise `afl-clang-fast` / `afl-gcc-fast`. Restrict instrumentation with allow/deny lists ([[raw/aflplus.plus/afl-fuzzing-in-depth-4291|AFL++ in depth]]). - **Magic-value solving:** laf-intel/COMPCOV splits comparisons; CMPLOG/RedQueen (input-to-state) is usually better and needs a second build with `AFL_LLVM_CMPLOG=1`. Persistent mode is a x2–x20 speedup — the docs' own line is that fuzzing without it is "for a hobby and not professionally". - **Multi-core layout:** ```bash afl-system-config # host tuning; not on prod systems afl-fuzz -M primary -i seeds -o state -- ./fuzz afl-fuzz -S secondary01 -i seeds -o state -- ./fuzz afl-fuzz -c0 -S cmplog -i seeds -o state -- ./fuzz # cmplog instance afl-fuzz -i seeds -o out -x png.dict -- ./fuzz # dictionary watch -n1 --color afl-whatsup state/ ``` Run one or two CMPLOG instances and one to three laf-intel instances; set `AFL_CMPLOG_ONLY_NEW=1` when resuming and keep an `afl-cmin`-minimized corpus ([[raw/aflplus.plus/afl-fuzzing-in-depth-4291|AFL++ in depth]], [[raw/appsec.guide/afl-testing-handbook-3925|Testing Handbook: AFL++]]). v5.03c dropped classic `afl-cc` instrumentation for LLVM-only, added a Value Profile implementation and a "starved" mode ([[raw/github.com/afl-releases-v5-03c-14827|AFL++ v5.03c]]). - **Triage:** `afl-cmin`, `afl-tmin -i crashes/id:000000* -o crash.min`, replay against an ASan build, group by ASan summary ([[raw/binaryexploitation.org/coverage-guided-fuzzing-with-libfuzzer-and-afl-13805|binaryexploitation.org]], [[raw/brucemikel.com/fuzzing-libming-with-afl-from-177-crashes-to-a-root-cause-14267|libming: 177 crashes to a root cause]]). ### Binary-only targets - **QEMU mode** (`afl-fuzz -Q`, `AFL_INST_LIBS=1`) JIT-instruments at translation time at a 2–5x slowdown. `AFL_QEMU_PERSISTENT_ADDR=<func entry>` + `AFL_QEMU_PERSISTENT_CNT=10000` is the biggest exec-rate lever; when input lives in a register/buffer, `AFL_QEMU_PERSISTENT_HOOK` must copy it in, or every iteration re-runs the same input "full speed, zero coverage growth" ([[raw/fuzze.rs/fuzzing-closed-source-binaries-with-afl-qemu-mode-13632|AFL++ QEMU mode]]). - Airbus combined QEMU persistent mode with `AFL_CUSTOM_MUTATOR_LIBRARY` (libprotobuf) against an X509 parser — see [[Grammar-Based Fuzzing]] ([[raw/airbus-seclab.github.io/advanced-binary-fuzzing-using-afl-qemu-and-libprotobuf-4882|Airbus SecLab]]). - **Unicorn mode** when QEMU is too heavy; snapshot fuzzing (wtf, Nyx, LibAFL-QEMU) for long-startup or stateful targets — see [[Fuzzing Harness Design]] and [[Kernel Fuzzing]]. ### Hard branches: hybrid fuzzing CmpLog infers byte dependencies by re-running; concolic engines trace them. In a 15-target experiment, SymSan + input-to-state solving beat AFL++ CmpLog/RedQueen on throughput in 13 and median line coverage in 8 (2 ties); with ordinary mutations off it won coverage on 12/15 ([[raw/chengyusong.github.io/concolic-execution-does-not-have-to-be-slow-symsan-vs-cmplog-14266|SymSan vs CmpLog]]). oss-sydr-fuzz layers Sydr DSE over OSS-Fuzz builds for projects on a plateau ([[raw/offsecblog.com/oss-sydr-fuzz-for-hybrid-fuzzing-of-open-source-c-projects-14957|oss-sydr-fuzz]]). ### Memory-safe and managed languages | Ecosystem | Engine | Notes | |---|---|---| | Rust | cargo-fuzz (libFuzzer) | `cargo fuzz init`; `cargo +nightly fuzz run t -- -dict=d.dict`; `--sanitizer none` for speed when no `unsafe` ([[raw/appsec.guide/cargo-fuzz-testing-handbook-3906|cargo-fuzz]]) | | Go | gosentry (ToB fork of the toolchain) | Same `testing.F` harnesses; `go test -fuzz` runs LibAFL in-process, adds struct fuzzing, Nautilus grammars, overflow/goroutine-leak/race/timeout detection ([[raw/blog.trailofbits.com/go-fuzzing-was-missing-half-the-toolkit-we-forked-the-toolchain-to-fix-8584|gosentry]]) | | Go | go-panikint | Compiler patch turning silent integer overflow/truncation into panics; found the Cosmos SDK RPC pagination overflow (offset+limit) ([[raw/blog.trailofbits.com/detect-go-s-silent-arithmetic-bugs-with-go-panikint-4879|go-panikint]]) | | JVM | Jazzer | JUnit 5 integration; sanitizers for SSRF, path traversal, OS command injection that also steer mutation ([[raw/github.com/jazzer-coverage-guided-in-process-fuzzing-for-the-jvm-4876|Jazzer]]); Team Atlanta swapped its libFuzzer backend for LibAFL ([[raw/team-atlanta.github.io/jazzer-libafl-java-fuzzing-insights-3910|Jazzer + LibAFL]]) | | Node/TS | Jazzer.js | libFuzzer-based, Jest integration, crashers become regression tests ([[raw/offsecblog.com/jazzer-js-for-coverage-guided-fuzzing-of-node-js-and-typescript-13633|Jazzer.js]]) | | Python | Atheris | `FuzzedDataProvider`; uncaught exceptions such as `ZeroDivisionError` are crashes ([[raw/seeinglogic.com/getting-started-with-python-fuzzing-using-atheris-3903|Atheris]]) | | Ruby | Ruzzy + LibAFL | Needed LLVM `ld` for `.preinit_array` and correct SanitizerCoverage init timing to avoid "No maps available" ([[raw/blog.trailofbits.com/extending-ruzzy-with-libafl-8583|Ruzzy + LibAFL]]) | | Kotlin / Elixir | kotlinx.fuzz (on Jazzer), ex_fuzz (ExUnit) | ([[raw/blog.jetbrains.com/bringing-fuzz-testing-to-kotlin-with-kotlinx-fuzz-4881|kotlinx.fuzz]], [[raw/github.com/ex-fuzz-coverage-guided-fuzz-testing-for-elixir-15712|ex_fuzz]]) | LibAFL itself is the Rust library for building custom fuzzers, with a libFuzzer drop-in and restarting event managers for multi-process runs ([[raw/appsec.guide/libafl-testing-handbook-3912|Testing Handbook: LibAFL]]). ## Notable cases - **Ada Logics / OSS-Fuzz:** 115 projects integrated, 2104 bugs (559 security-relevant), 1330 fixed, incl. CVE-2020-28362 in go-ethereum ([[raw/adalogics.com/fuzzing-100-open-source-projects-with-oss-fuzz-lessons-learned-4877|Ada Logics]]). - **Bugs that survive continuous fuzzing:** GStreamer had 2 fuzzers and ~19% coverage after seven years in OSS-Fuzz (OpenSSL: 139 fuzzers; bzip2: 93%) — GHSL found 29 vulns. Poppler (16 fuzzers, ~60%) received no feedback from un-instrumented deps, and DjVuLibre wasn't in the build at all; that's where the 1-click Evince RCE (CVE-2025-53367) lived. Exiv2 still produced CVE-2025-26623/-54080 ([[raw/github.blog/bugs-that-survive-continuous-fuzzing-3916|GitHub: Bugs that survive continuous fuzzing]]). - **libslirp CVE-2026-9539** was missed by an earlier campaign and only reached with LibAFL-QEMU incremental snapshots ([[raw/blog.quarkslab.com/snapshotting-our-way-to-cve-2026-9539-quarkslab-14269|Quarkslab]]). - **Null results are data:** a json-c AFL++/ASan run on a 4 GB VM found nothing — a well-fuzzed target plus setup mistakes ([[raw/lastknowngood.medium.com/fuzzing-json-c-with-afl-and-asan-on-a-4-gb-vm-setup-mistakes-and-a-nul-12820|json-c null result]]). ## Defenses (for maintainers) - Track per-project coverage and fuzzer count in Fuzz Introspector; build dependencies with instrumentation; verify the OSS-Fuzz build actually succeeds — enrollment is not coverage. - Use `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` to bypass checksums/CPU-heavy checks; ship seeds and dictionaries; run short fuzz jobs in CI and keep the corpus as a regression suite. ## Related - [[Fuzzing]] - [[Fuzzing Harness Design]] - [[Grammar-Based Fuzzing]] - [[LLM-Assisted Fuzzing]] - [[Kernel Fuzzing]] - [[Differential Fuzzing]] - [[API Fuzzing]] ## Sources - [[raw/github.com/afl-american-fuzzy-lop-a-security-oriented-fuzzer-2926|AFL - American Fuzzy Lop: A Security-Oriented Fuzzer]] - [[raw/appsec.guide/fuzzing-testing-handbook-appsec-guide-4285|Fuzzing | Testing Handbook - AppSec Guide]] - [[raw/llvm.org/libfuzzer-a-library-for-coverage-guided-fuzz-testing-llvm-2925|libFuzzer - A Library for Coverage-Guided Fuzz Testing | LLVM]] - [[raw/google.github.io/libfuzzer-and-afl-clusterfuzz-2924|libFuzzer and AFL++ | ClusterFuzz]] - [[raw/google.github.io/coverage-guided-vs-blackbox-fuzzing-clusterfuzz-2920|Coverage Guided vs Blackbox Fuzzing | ClusterFuzz]] - [[raw/blog.includesecurity.com/coverage-guided-fuzzing-extending-instrumentation-to-hunt-down-bugs-fa-2927|Coverage Guided Fuzzing - Extending Instrumentation to Hunt Down Bugs Faster]] - [[raw/binaryexploitation.org/coverage-guided-fuzzing-with-libfuzzer-and-afl-13805|Coverage-guided fuzzing with libFuzzer and AFL++]] - [[raw/github.com/libfuzzer-fork-mode-null-dereference-bug-report-14826|libFuzzer fork mode NULL dereference bug report]] - [[raw/aflplus.plus/afl-fuzzing-in-depth-4291|AFL++ Fuzzing in Depth]] - [[raw/appsec.guide/afl-testing-handbook-3925|AFL++ - Testing Handbook]] - [[raw/github.com/afl-releases-v5-03c-14827|AFL++ releases (v5.03c)]] - [[raw/brucemikel.com/fuzzing-libming-with-afl-from-177-crashes-to-a-root-cause-14267|Fuzzing libming with AFL++: from 177 crashes to a root cause]] - [[raw/fuzze.rs/fuzzing-closed-source-binaries-with-afl-qemu-mode-13632|Fuzzing closed-source binaries with AFL++ QEMU mode]] - [[raw/airbus-seclab.github.io/advanced-binary-fuzzing-using-afl-qemu-and-libprotobuf-4882|Advanced binary fuzzing using AFL++-QEMU and libprotobuf]] - [[raw/chengyusong.github.io/concolic-execution-does-not-have-to-be-slow-symsan-vs-cmplog-14266|Concolic execution does not have to be slow (SymSan vs CmpLog)]] - [[raw/offsecblog.com/oss-sydr-fuzz-for-hybrid-fuzzing-of-open-source-c-projects-14957|oss-sydr-fuzz for hybrid fuzzing of open source C projects]] - [[raw/appsec.guide/cargo-fuzz-testing-handbook-3906|cargo-fuzz - Testing Handbook]] - [[raw/blog.trailofbits.com/go-fuzzing-was-missing-half-the-toolkit-we-forked-the-toolchain-to-fix-8584|Go fuzzing was missing half the toolkit. We forked the toolchain to fix it.]] - [[raw/blog.trailofbits.com/detect-go-s-silent-arithmetic-bugs-with-go-panikint-4879|Detect Go's silent arithmetic bugs with go-panikint]] - [[raw/github.com/jazzer-coverage-guided-in-process-fuzzing-for-the-jvm-4876|Jazzer: Coverage-guided, in-process fuzzing for the JVM]] - [[raw/team-atlanta.github.io/jazzer-libafl-java-fuzzing-insights-3910|Jazzer + LibAFL: Java Fuzzing Insights]] - [[raw/offsecblog.com/jazzer-js-for-coverage-guided-fuzzing-of-node-js-and-typescript-13633|Jazzer.js for coverage-guided fuzzing of Node.js and TypeScript]] - [[raw/seeinglogic.com/getting-started-with-python-fuzzing-using-atheris-3903|Getting Started with Python Fuzzing Using Atheris]] - [[raw/blog.trailofbits.com/extending-ruzzy-with-libafl-8583|Extending Ruzzy with LibAFL]] - [[raw/blog.jetbrains.com/bringing-fuzz-testing-to-kotlin-with-kotlinx-fuzz-4881|Bringing Fuzz Testing to Kotlin with kotlinx.fuzz]] - [[raw/github.com/ex-fuzz-coverage-guided-fuzz-testing-for-elixir-15712|ex_fuzz: coverage-guided fuzz testing for Elixir]] - [[raw/appsec.guide/libafl-testing-handbook-3912|LibAFL - Testing Handbook]] - [[raw/adalogics.com/fuzzing-100-open-source-projects-with-oss-fuzz-lessons-learned-4877|Fuzzing 100+ open source projects with OSS-Fuzz - lessons learned]] - [[raw/github.blog/bugs-that-survive-continuous-fuzzing-3916|Bugs That Survive Continuous Fuzzing]] - [[raw/blog.quarkslab.com/snapshotting-our-way-to-cve-2026-9539-quarkslab-14269|Snapshotting our way to CVE-2026-9539 (Quarkslab)]] - [[raw/lastknowngood.medium.com/fuzzing-json-c-with-afl-and-asan-on-a-4-gb-vm-setup-mistakes-and-a-nul-12820|Fuzzing json-c with AFL++ and ASan on a 4 GB VM: setup, mistakes, and a null result]]