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 (AFL). The Trail of Bits handbook calls mutation-based evolutionary fuzzing the de facto algorithm and defines the vocabulary: SUT, fuzzer, harness, corpus (Testing Handbook: Fuzzing).
- Instrumentation. libFuzzer relies on LLVM SanitizerCoverage (
-fsanitize=fuzzer, or-fsanitize-coverage=trace-pc-guardfor AFL-style builds) and needs a matching Clang (libFuzzer, ClusterFuzz: libFuzzer and AFL++). The coverage callback is hookable: Include Security patched Fuzzilli’s__sanitizer_cov_trace_pc_guardfor JerryScript to also capture__builtin_return_address(0)and symbolize each new edge with__sanitizer_symbolize_pc(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 (ClusterFuzz: coverage-guided vs blackbox).
Techniques / commands
libFuzzer
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 (libFuzzer, binaryexploitation.org). Fork mode itself had a parent-process NULL deref when a feature file is missing or empty (libFuzzer fork-mode bug).
AFL++
- Compiler choice: LLVM 11+ →
afl-clang-lto(LTO mode); otherwiseafl-clang-fast/afl-gcc-fast. Restrict instrumentation with allow/deny lists (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:
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 (AFL++ in depth, Testing Handbook: AFL++). v5.03c dropped classic afl-cc instrumentation for LLVM-only, added a Value Profile implementation and a “starved” mode (AFL++ v5.03c).
- Triage:
afl-cmin,afl-tmin -i crashes/id:000000* -o crash.min, replay against an ASan build, group by ASan summary (binaryexploitation.org, 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=10000is the biggest exec-rate lever; when input lives in a register/buffer,AFL_QEMU_PERSISTENT_HOOKmust copy it in, or every iteration re-runs the same input “full speed, zero coverage growth” (AFL++ QEMU mode). - Airbus combined QEMU persistent mode with
AFL_CUSTOM_MUTATOR_LIBRARY(libprotobuf) against an X509 parser — see Grammar-Based Fuzzing (Airbus SecLab). - LibAFL Frida mode trades emulation for the real device: fuzzer, harness
.soand target library share one process; Frida Gum’s Stalker copies each basic block of the instrumented ranges into a code cache and emits (1) AFL edge coverage (prev ^ loc, NeverZero hitcounts, reusing Stalker’s x16/x17 spill so flags are untouched), (2) CmpLog calls onSUBS/CMP,CBZ/CBNZ,TBZ/TBNZfeeding I2S replacement (it handed the fuzzer the legal JPEG component IDs), and (3) binary-level ASan shadow checks with hooked allocators. Everything outside the target and harness ranges is excluded and runs natively; the cache persists, so after warm-up it runs near native speed. Needs no root or frida-server because Gum is a library inside the fuzzer and theshellSELinux domain may generate code. On Android, LibAFL 0.16’s Frida ASan failed (39-bit address space vs a shadow search starting at bit 44;has_tls()readingTPIDRRO_EL0, valid only on Apple; a futex hang inunpoison_all_existing_memory()), so the campaign used crash detection plus a separately built ASan reproducer (Mobile Hacking Lab). See Mobile Application Security. - 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 (SymSan vs CmpLog). oss-sydr-fuzz layers Sydr DSE over OSS-Fuzz builds for projects on a plateau (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 |
| 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 |
| 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 |
| 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 |
| 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 |
| Python | Atheris | FuzzedDataProvider; uncaught exceptions such as ZeroDivisionError are crashes ([[raw/seeinglogic.com/getting-started-with-python-fuzzing-using-atheris-3903 |
| 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 |
| Kotlin / Elixir | kotlinx.fuzz (on Jazzer), ex_fuzz (ExUnit) | ([[raw/blog.jetbrains.com/bringing-fuzz-testing-to-kotlin-with-kotlinx-fuzz-4881 |
LibAFL itself is the Rust library for building custom fuzzers, with a libFuzzer drop-in and restarting event managers for multi-process runs (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 (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 (GitHub: Bugs that survive continuous fuzzing).
- Samsung Quram CVE-2026-21096 (progressive-JPEG IDCT OOB write via scan/frame component-index mismatch, originally P0) rediscovered on an unrooted Galaxy S25 with LibAFL Frida mode: first crash within a second (one sampling byte
0x11 → 0x12on a seed with a subset scan), and in 8 s / 13 objectives in 3.5 min after those seeds were removed; throughput fell from ~30k to ~9k exec/s as the phone heated and the corpus grew (Mobile Hacking Lab). - OSS-Fuzz-found parser bugs: jxrlib global over-read in
initLookupTables()from an unchecked bit-depth index (CVE-2024-58408); OpenCVYAMLParser::parseinfinite loop on a crafted dash line (CVE-2026-135290). Both are input-validation gaps in format parsers reachable from a file open (jxrlib, OpenCV). - libslirp CVE-2026-9539 was missed by an earlier campaign and only reached with LibAFL-QEMU incremental snapshots (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 (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_PRODUCTIONto 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
- Fuzzing Android Libraries with LibAFL Frida Mode: CVE-2026-21096 in Samsung Quram · original
- Microsoft jxrlib global buffer overflow (fuzzer-found) · original
- OpenCV infinite loop vulnerability (fuzzer-found) · original
- AFL - American Fuzzy Lop: A Security-Oriented Fuzzer · original
- Fuzzing | Testing Handbook - AppSec Guide · original
- libFuzzer - A Library for Coverage-Guided Fuzz Testing | LLVM · original
- libFuzzer and AFL++ | ClusterFuzz · original
- Coverage Guided vs Blackbox Fuzzing | ClusterFuzz · original
- Coverage Guided Fuzzing - Extending Instrumentation to Hunt Down Bugs Faster · original
- Coverage-guided fuzzing with libFuzzer and AFL++ · original
- libFuzzer fork mode NULL dereference bug report · original
- AFL++ Fuzzing in Depth · original
- AFL++ - Testing Handbook · original
- AFL++ releases (v5.03c) · original
- Fuzzing libming with AFL++: from 177 crashes to a root cause · original
- Fuzzing closed-source binaries with AFL++ QEMU mode · original
- Advanced binary fuzzing using AFL++-QEMU and libprotobuf · original
- Concolic execution does not have to be slow (SymSan vs CmpLog) · original
- oss-sydr-fuzz for hybrid fuzzing of open source C projects · original
- cargo-fuzz - Testing Handbook · original
- Go fuzzing was missing half the toolkit. We forked the toolchain to fix it. · original
- Detect Go's silent arithmetic bugs with go-panikint · original
- Jazzer: Coverage-guided, in-process fuzzing for the JVM · original
- Jazzer + LibAFL: Java Fuzzing Insights · original
- Jazzer.js for coverage-guided fuzzing of Node.js and TypeScript · original
- Getting Started with Python Fuzzing Using Atheris · original
- Extending Ruzzy with LibAFL · original
- Bringing Fuzz Testing to Kotlin with kotlinx.fuzz · original
- ex_fuzz: coverage-guided fuzz testing for Elixir · original
- LibAFL - Testing Handbook · original
- Fuzzing 100+ open source projects with OSS-Fuzz - lessons learned · original
- Bugs That Survive Continuous Fuzzing · original
- Snapshotting our way to CVE-2026-9539 (Quarkslab) · original
- Fuzzing json-c with AFL++ and ASan on a 4 GB VM: setup, mistakes, and a null result · original