Reverse Engineeringfuzzerfuzzingcoverage-guidedinstrumentationbinarysecurity-testing

afl++

Instrumentation-driven fuzzer for binary formats that uses compile-time instrumentation and genetic algorithms to discover test cases triggering new internal states.

Description

American Fuzzy Lop Plus (afl++) is a fork of the original AFL fuzzer. It employs compile-time instrumentation and genetic algorithms to automatically discover clean, interesting test cases that trigger new internal states in the targeted binary, substantially improving functional coverage. The compact synthesized corpora produced are useful for seeding other testing regimes.

AFL++ is designed to be practical with modest performance overhead, effective fuzzing strategies, no configuration needed, and handles complex real-world use cases like image parsing or file compression libraries seamlessly. It supports multiple instrumentation modes including LLVM, GCC plugins, and binary-only fuzzing with QEMU, Unicorn, and FRIDA.

Use cases include finding bugs in binary-only applications, improving code coverage for security testing, generating test corpora, and crash reproduction in software from parsers to network services.

How It Works

AFL++ instruments the target binary at compile time using LLVM passes, GCC plugins, or binary-only modes (QEMU/FRIDA/Unicorn/Nyx). Instrumentation adds code to track edge coverage via a shared memory bitmap. During fuzzing, afl-fuzz mutates input seeds using genetic algorithms, prioritizing inputs that discover new coverage transitions. Queue management favors high-energy inputs (those finding new coverage), with strategies like power schedules and splicing. Crashes/hangs are detected via timeouts and exit codes, with deterministic fuzzing phases followed by havoc/exploit modes. Features like persistent mode, LAF comparisons, and CMPLOG enhance efficiency.

Installation

bash
sudo apt install afl++

Flags

-i dirinput directory with test cases
-o diroutput directory for fuzzer findings
-f filelocation read by fuzzed program (stdin or @@)
-m megsmemory limit for child process (0=unlimited)
-t msectimeout per run (auto-scaled default 1000ms)
-Quse QEMU binary-only instrumentation
-Uuse Unicorn binary-only instrumentation
-Ouse FRIDA binary-only instrumentation
-x dict_filefuzzer dictionary (specify up to 4 times)
-M/-S iddistributed fuzzing mode

Examples

Basic fuzzing of ./program reading from stdin, input from testcases/, output to findings/
afl-fuzz -i testcases -o findings -- ./program @@
Fuzz with unlimited memory, 2s+ timeout, program reads @@ writes to output file
afl-fuzz -i testcases -o findings -m none -t 2000+ -- ./program -i @@ -f output
Instrument and compile target program with AFL++ compilers
CC=afl-cc CXX=afl-c++ make clean all
Distributed fuzzing with master fuzzer1 and secondary fuzzer2
afl-fuzz -i testcases -o findings -M fuzzer1 -S fuzzer2 -- ./program @@
Minimize corpus to essential test cases
afl-cmin -i full-corpus -o min-corpus -- ./program @@
Minimize single test case to shortest crashing/hanging input
afl-tmin -i seed -o minimized -- ./program @@
Capture coverage bitmap for seed input to mapfile
afl-showmap -o mapfile -- ./program seed
Python corpus minimization preserving coverage
afl-cmin.py -i input -o output -- ./program @@
Updated 2026-03-02kali.org ↗