AFL++ exposes extensive functionality through environment variables, allowing you to customize compilation, instrumentation, and runtime behavior without modifying source code.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AFLplusplus/AFLplusplus/llms.txt
Use this file to discover all available pages before exploring further.
Most AFL++ tools warn about unknown AFL_* environment variables (e.g., typos). Set
AFL_IGNORE_UNKNOWN_ENVS to disable these warnings.Compiler Settings
These variables control AFL++ compiler behavior (afl-cc, afl-clang-fast, afl-clang-lto, afl-gcc-fast).
Compiler Selection
Select instrumentation mode:
GCC_PLUGIN: afl-g*-fastLLVM: afl-clang-fast*LTO: afl-clang-lto*
Downstream C compiler to use instead of default
clang or gcc.Downstream C++ compiler to use instead of default
clang++ or g++.Prepend a command to compiler invocations (e.g.,
ccache for faster recompilation).Optimization Settings
Disable automatic
-O3 optimization. Use if -Werror causes issues with optimization warnings.Set optimization level (e.g.,
z for -Oz, s for -Os).Compile without AFL++ instrumentation (useful for
./configure scripts). Unset before building the actual target!Hardening
Automatically add hardening options:
-D_FORTIFY_SOURCE=2 and -fstack-protector-all. Minor performance loss (~5%).Instrumentation Control
Instrument only a percentage of branches. Useful for very complex programs (ffmpeg, perl, v8).
0 = function transitions only.Generate code suitable for
libtokencap.so (slightly slower).Output Control
Suppress afl-cc/afl-as banners during compilation.
Force output even when stdout/stderr are redirected. Useful for debugging build issues.
Sanitizers
Enable AddressSanitizer (memory corruption detection).
Enable MemorySanitizer (uninitialized memory detection).
Enable UndefinedBehaviorSanitizer.
Output detailed diagnostics for undefined behavior (instead of just “Illegal Instruction”).
Enable Control Flow Integrity Sanitizer (type confusion detection).
Output detailed CFI violation information.
Enable ThreadSanitizer (race condition detection).
Enable LeakSanitizer. Requires
__AFL_LEAK_CHECK(); in target code.Enable RealtimeSanitizer (requires clang 20+).
Paths
Directory containing AFL++ runtime objects, plugins, and QEMU/Frida support files.
Directory for temporary files used by afl-as.
LLVM/LTO Instrumentation
These variables are specific toafl-clang-fast, afl-clang-lto, and LLVM modes.
Instrumentation Mode
Select instrumentation type. Options:
CLASSIC: Classic AFL (colliding coverage)PCGUARD: pcguard-based (default, non-colliding)NATIVE: Clang’s original pcguardCTX: Context-sensitive coverageNGRAM-X: N-gram coverage (X = 2-16)LTO: LTO instrumentationCFG: Control Flow Graph (LTO mode)
CLASSIC,CTX,NGRAM-4CMPLOG
Produce a CMPLOG instrumented binary for input-to-state correspondence.
CMPLOG for afl-gcc-fast.
Context-Sensitive Coverage
Activate context-sensitive branch coverage (each edge combined with caller).
N-gram Coverage
Activate N-gram previous location coverage.
LAF-Intel / COMPCOV
Enable all LAF-Intel transformations (split compares, switches, floats).
Split integer comparisons (64/32/16-bit CMP instructions).
Split
switch constructs.Split floating point comparisons (requires
AFL_LLVM_LAF_SPLIT_COMPARES).Transform string comparison functions.
Dictionary Generation
Write constant string comparisons to dictionary file.
Skip parsing
main() when generating dictionary.Selective Instrumentation
Instrument only files/functions listed in this file.Format (one per line):
Skip instrumenting files/functions listed in this file.
Injection Detection
Enable all injection vulnerability hooks (SQL, LDAP, XSS).
Enable SQL injection hooks.
Enable LDAP injection hooks.
Enable XSS injection hooks in libxml2.
Advanced LLVM Options
Use counters that skip zero on overflow (default for LLVM ≥ 9).
Disable never-zero counter test (small performance boost for targets with few loops).
Inject thread-safe instrumentation counters (disables neverzero).
Abort when any
exec* function is called (prevents coverage map corruption).Disable setting rpath when LLVM is not in a standard location.
LTO Mode Specific
Set fixed map address (default:
0x10000). Use 0 for dynamic (slower).Document which edge ID was assigned to which function.
Starting location ID for instrumentation.
GCC Plugin Settings
Instrument only files listed (GCC_PLUGIN mode). Alias:
AFL_GCC_ALLOWLIST.Skip files/functions listed (GCC_PLUGIN mode).
Use subroutine calls instead of inline instrumentation (slower).
Disable never-zero counter test in GCC mode.
Prevent afl-as from deleting instrumented assembly files (GCC mode only).
Runtime Settings (Instrumented Binaries)
Dump the map size of the target and exit.
Use vanilla AFL forkserver (for compatibility with other tools like symcc).
Disable instrumentation collection (internal use).
afl-fuzz Settings
These controlafl-fuzz behavior at runtime.
Basic Options
Resume fuzzing from existing output directory even if different
-i is provided.Use custom placeholder instead of
@@ for input file.Skip CPU frequency scaling check.
Disable CPU core binding (allows running more instances than cores).
Try CPU binding but don’t fail if unavailable.
Mutator Configuration
Load custom mutator library (C/C++). Supports multiple (semicolon-separated).
Python module name for custom mutator.
Use only custom mutators, disable AFL++ mutations.
Call
afl_custom_fuzz_send() after target restart (for TCP services).Disable test case trimming (usually a bad idea).
Start in extended havoc mode immediately (normally enabled automatically).
Skip deterministic arithmetics (useful for text formats).
Dictionary Options
Don’t load LTO auto-generated dictionary.
Threshold for probabilistic dictionary mode.
CMPLOG Options
Run CMPLOG only on new findings, not startup seeds.
Seed Handling
Skip crashing/timeout seeds instead of exiting.
Restore vanilla AFL behavior: exit on crash/timeout seeds.
Treat crashing seeds as new crashes (written to crashes folder).
Performance Tuning
Speed up calibration stage (~2.5x faster, less precise).
Skip initial seed calibration, start fuzzing immediately.
Override
TESTCASE_CACHE size. Recommended: 50-250MB.Write
.cur_input file to this directory (use ramdisk for speed).Timeout/Memory
Timeout to wait for forkserver startup.
Timeout for determining if input is a “hang”.
Signal to deliver to child on timeout (default: SIGKILL).
Signal to deliver to fork server on exit.
Set coverage map size (must match compiled target).
Minimum generated input length.
Maximum generated input length.
Parallel Fuzzing
Import test cases from other instances before doing anything else.
Perform final import of test cases when terminating (for
-M main fuzzer).Minimum time between fuzzing instance synchronization.
Disable all syncing (overrides other sync options).
Exit Conditions
Terminate if no new paths found within specified time.
Terminate when all paths fuzzed and no finds for a while.
Crash Handling
Treat specific exit code as crash.
Allow writing core files on crashes.
Don’t write README.txt to crashes directory.
Debugging
Don’t suppress child output (useful for debugging).
Disable UI, print basic stats periodically.
Force UI even without valid terminal.
Disable colored console output.
Print each filename as it’s processed (for afl-cmin, afl-showmap).
Advanced Options
Set
LD_PRELOAD for target without affecting afl-fuzz.Set environment variables for target binary.
Disable forkserver optimization (fork + execve for every test).
Enforce deferred forkserver even if not detected.
Enforce persistent mode even if not detected.
Record N previous inputs before crash in persistent mode.
Must be enabled in config.h first!
Randomly reorder input queue on startup.
Name files by SHA1 hash instead of
id:000000,....Switch power schedule after each cycle.
Keep longer-running inputs if they reach new coverage.
Ignore timeouts entirely for extra speed.
Disable redundant queue items.
Frameshift
Disable frameshift analysis stage.
Maximum fraction of time frameshift can consume (0.0-1.0).
Statistics
Enable StatsD metrics collection.
StatsD server host.
StatsD server port.
StatsD tags format:
dogstatsd, influxdb, librato, signalfx.Interval to update fuzzer_stats file.
QEMU Mode Settings
Skip prepending
afl-qemu-trace (use custom QEMU).Specify entry point into binary (must be basic block address).
Instrument dynamically linked libraries (including glibc).
Instrument only specific memory ranges.
Exclude specific memory ranges from instrumentation.
CompareCoverage level for QEMU/libcompcov.
1: Only immediate values / read-only memory2: All comparisons (more accurate, needs larger map)
Address of persistent loop body function.
Save/restore general purpose registers in persistent mode.
Third-Party Sanitizer Options
AFL++ sets these to optimal values, but you can override:ASAN Options
MSAN Options
LSAN Options
Quick Reference by Use Case
Fast compilation for CI
Fast compilation for CI
Maximum speed fuzzing
Maximum speed fuzzing
Debug instrumentation issues
Debug instrumentation issues
Parallel fuzzing campaign
Parallel fuzzing campaign
Structure-aware fuzzing
Structure-aware fuzzing

