Download tasks/data/reverse/0xricksanchez__afl_runner.18ec78b/environment/docs/README.md from Lego-X/ProgramGen: direct link, hf CLI and curl.
- Browser
- Download file 9.08 kB
-
https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/0xricksanchez__afl_runner.18ec78b/environment/docs/README.md
- Command line
-
hf download hf://datasets/Lego-X/ProgramGen/tasks/data/reverse/0xricksanchez__afl_runner.18ec78b/environment/docs/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/0xricksanchez__afl_runner.18ec78b/environment/docs/README.md
AFL Runner
AFL_Runner is a modern CLI tool designed to streamline running efficient
multi-core AFLPlusPlus campaigns.
The default configuration is based on the section
Using multiple cores
of the official documentation.
The executable is named aflr.
Getting Started
Currently, this tool should work on all *NIX flavor operating-systems.
Prerequisites
- Rust toolchain v1.85.0
- AFLPlusPlus
- pgrep
- TMUX or screen (optional, for TUI)
- LLVM (optional, for coverage reporting)
Installation
Compile from source:
git clone https://github.com/0xricksanchez/AFL_Runner.git
cd AFL_Runner
cargo build --release
./target/release/aflr --help
# Optional: Generate completion scripts
cargo run --features completion --bin generate_completions
Or install directly via crates.io:
cargo install afl_runner
aflr --help
# Alternatively, with completion support included
cargo install --path . --features completion
Features
AFL_Runner allows you to set the most necessary AFLPlusPlus flags and mimics
the AFLPlusPlus syntax for these options.
Supported AFLPlusPlus flags:
- Corpus directory
- Output directory
- Dictionary file/directory
- Custom
afl-fuzzbinary path for all instances - Supply arguments to target binary (including
@@) - Amount of runner commands to generate
- Support for *SAN, CMPLOG, CMPCOV binaries
Other features:
- Coverage collection/visualization
tmuxorscreenoption to automatically create an appropriate layout for all runners- TUI
- Provide a configuration file via
--configto make sharing/storing per-project configurations easier- Automatically read a configuration named
aflr_cfg.tomlin the current working directory when no--configis supplied
- Automatically read a configuration named
- Modes:
default(vanilla AFL++),multiple-cores(Ref.), andci-fuzzing(Ref.) - Deterministic command generation and AFL++ with seeding
Note: Arguments supplied over the command-line take precedence over any configuration file options.
Subcommands
| Subcommand | Description |
|---|---|
gen |
Only generate commands for the fuzzing campaign, don't run them |
run |
Generate the fuzzing campaign and run it |
cov |
Collect and visualize fuzzing coverage |
tui |
Show stats TUI for a running campaign |
kill |
Kill a running session and all spawned processes inside |
add-seed |
Add new seeds to a running campaign |
Usage / Flags
gen — generate commands only
aflr gen [OPTIONS] [TARGET_ARGS]...
| Flag | Description |
|---|---|
-t, --target <PATH> |
Instrumented target binary to fuzz |
-s, --san-target <PATH> |
Instrumented with *SAN binary to use |
-c, --cmpl-target <PATH> |
Instrumented with CMPLOG binary to use |
-l, --cmpc-target <PATH> |
Instrumented with Laf-intel/CMPCOV binary to use |
[TARGET_ARGS]... |
Target binary arguments, including @@ if needed |
--nyx-mode |
Use AFL++'s Nyx mode |
-n, --runners <NUM_PROCS> |
Amount of processes to spin up |
-i, --input-dir <PATH> |
Seed corpus directory |
-o, --output-dir <PATH> |
Solution/Crash output directory |
-x, --dictionary <DICT_FILE> |
Token dictionary to use |
-b, --afl-binary <PATH> |
Custom path to afl-fuzz binary |
--config <PATH> |
Path to TOML config file |
-m, --mode <MODE> |
Select fuzzing mode (default, multiple-cores, ci-fuzzing) |
--seed <AFLR_SEED> |
Seed for AFL_Runner's PRNG for deterministic command generation |
--use-seed-afl |
Forward AFLR seed to AFL++ (requires --seed) |
run — generate and run
aflr run [OPTIONS] [TARGET_ARGS]...
Accepts all gen flags (see above) plus:
| Flag | Description |
|---|---|
--dry-run |
Output commands without executing |
--session-runner <tmux|screen> |
Session runner to use (default: tmux) |
--session-name <NAME> |
Custom runner session name |
--tui |
Enable TUI mode |
--detached |
Start detached from session (not compatible with TUI) |
--is-ramdisk |
Use RAMDisk for AFL++ |
cov — coverage collection/visualization
aflr cov [OPTIONS] [TARGET_ARGS]...
| Flag | Description |
|---|---|
-t, --target <PATH> |
Instrumented target binary for coverage collection |
[TARGET_ARGS]... |
Target binary arguments, including @@ if needed |
-i, --output-dir <PATH> |
Top-level AFL++ output directory |
--split-report |
Do not merge all coverage files into a single report |
--text-report |
Force text-based coverage report |
-a, --show-args <ARGS>... |
Miscellaneous llvm-cov show arguments |
-r, --report-args <ARGS>... |
Miscellaneous llvm-cov report arguments |
--config <PATH> |
Path to TOML config file |
tui — show stats TUI
aflr tui <AFL_OUTPUT>
| Argument | Description |
|---|---|
<AFL_OUTPUT> |
Path to an AFLPlusPlus campaign directory, e.g. afl_output |
The TUI can be used as a full replacement for
afl-whatsupviaaflr tui <afl_output_dir>.
kill — kill a running session
aflr kill <SESSION_NAME>
| Argument | Description |
|---|---|
<SESSION_NAME> |
Session name to kill (tab-completion available for tmux sessions) |
add-seed — add seeds to a running campaign
aflr add-seed [OPTIONS] [TARGET_ARGS]...
| Flag | Description |
|---|---|
-t, --target <PATH> |
Instrumented target binary to fuzz |
[TARGET_ARGS]... |
Target binary arguments, including @@ if needed |
-o, --output-dir <PATH> |
Solution/Crash output directory of the running campaign |
--config <PATH> |
Path to TOML config file |
--seed <SEED(S)> |
Seed(s) to add to the corpus |
Configuration File
A configuration file (TOML) can be passed via --config. When no --config is
supplied, AFL_Runner automatically reads a configuration named
aflr_cfg.toml in the current working directory.
The configuration is organized into the following sections: [target],
[coverage], [afl_cfg], [session], and [misc].
See AFLR_CFG_TEMPL.toml for a fully annotated example.
Available modes (in [afl_cfg] mode or -m/--mode):
Default— vanilla AFL++MultipleCores— recommended multi-core setup (default)CIFuzzing— CI-fuzzing setup
Default paths
| Path | Default value |
|---|---|
| Input/corpus directory | /tmp/afl_input |
| Output directory | /tmp/afl_output |
Shell Completion
The tool supports shell completion for tmux session names when using the
kill command. To enable completion:
- Generate the completion scripts:
cargo run --bin generate_completions
- Depending on your shell:
For ZSH:
# Option 1: Source directly
source completions/aflr_dynamic.zsh
# Option 2 (preferred): Install to completion directory
mkdir -p ~/.zsh/completions
cp completions/aflr_dynamic.zsh ~/.zsh/completions/_aflr
# Add to your .zshrc:
fpath=(~/.zsh/completions $fpath)
autoload -U compinit && compinit
For Bash:
# Add to your .bashrc:
source /path/to/completions/aflr_dynamic.bash
Once set up, use tab completion to see available tmux sessions:
aflr kill <TAB>
Example: multi-core fuzzing of libxml2
The repository ships an example that demonstrates using aflr to start a
best-practice multi-core fuzzing campaign for the libxml2 library. The build
is configured via Makefile.toml, while the campaign behavior is controlled
from an aflr_config.toml.
The default example pulls libxml2 v2.10.0. Testing another version requires:
- Updating the version number in the
Makefile.toml - Updating
aflr_config.tomlsoaflruses the updatedxmllintbuilds
Prerequisites
clangAFL++makeautoconf- Rust toolchain
cargo-make
Build and run
From the root directory of the project:
cargo make
This fetches all necessary files and builds the different xmllint binaries.
If the build succeeds, aflr spins up 16 fuzzing processes (per
aflr_config.toml) following the recommended best-practice setup described
here.
Note: Run
cargo make dry_runto only run the command generator (requires building) instead of running the actual fuzzing.
License
This project is licensed under the Apache License 2.0. See the LICENSE file for details.