Expand description
Welcome to LibAFL
§LibAFL Core
LibAFL Core is the main library and contains the fuzzing components and their implementations. A large part of this library depends only on Rust core+alloc and, thus, can run without any standard library.
The online documentation for this crate is available here.
§Feature Flags
§General Features
std(enabled by default) — Enables features that need rust’sstdlib to work, like print, env, … supporttrack_hit_feedbacks— Tracks the Feedbacks and the Objectives that were interesting for a Testcasevalue_bloom_feedback—ValueBloomFeedbackchecks if an observed value has already been observed, and returnsis_interesting=trueotherwise.introspection— Collects performance statistics of the fuzzing pipeline and displays it onMonitorcomponentsprelude— Exposelibafl::preludefor access without additional using directivesafl_exec_sec— Calculate exec/sec like AFL, using 5 second time windowserrors_backtrace(enabled by default) — Stores the backtraces of all generatedErrors. Good for debugging, but may come with a slight performance hit.corpus_btreemap— Switches fromHashMaptoBTreeMapforCorpusIdgzip(enabled by default) — Enables gzip compression in certain parts of the libfork(enabled by default) — If set, will use thefork()syscall to spawn children, instead of launching a new command, if supported by the OS (has no effect onWindows).handle_sigpipe— If this feature is set,LibAFLtargets (and the fuzzer) will crash onSIGPIPEon unix systems.
§Additional Components
tcp_manager— EnablesTcpEventManager, a simple EventManager proxying everything via TCP. This usestokio.tcp_compression— Enables compression for the TCP managermulti_machine— Enable multi-machine supportregex(enabled by default) — Enables theNaiveTokenizerandStacktraceObservercasr— Enables deduplication based onlibcasrforStacktraceObserverintel_pt— Intel Processor Traceintel_pt_export_raw— Save all the Intel PT raw traces to files, use only for debugcmin— Enables features for corpus minimizationprometheus_monitor— Enables thePrometheusMonitorwhich will monitor stats via UDP, forGrafanaand others.statsd_monitor— Enables theStatsdMonitor.concolic_mutation— Include a simple concolic mutator based on z3tui_monitor— Enable the fancy TuiMonitor for a termanal UI using crosstermunicode— EnablesUnicodeClassificationStageand associated mutators, which allow for mutations which preserve the Unicode property datamultipart_inputs— Enable multi-part input formats and mutators
§LibAFL-Bolts Features
derive(enabled by default) — Provide the#[derive(SerdeAny)]macro.cli— Exposelibafl_bolts::clifor easy commandline parsing of common fuzzer settingsqemu_cli— Enables extra commandline flags for qemu-based fuzzers inclifrida_cli— Enables extra commandline flags for frida-based fuzzers inclirand_trait(enabled by default) — If set, libafl_bolt’srandimplementations will implementrand::Rng
§SerdeAny features
serdeany_autoreg(enabled by default) — Automatically register all#[derive(SerdeAny)]types at startup.
§LLMP features
llmp_broker_timeouts(enabled by default) — The broker loop will yield occasionally, even without status messages from client nodesllmp_bind_public— If set, llmp will bind to 0.0.0.0, allowing cross-device communication. Binds to localhost by default.llmp_compression(enabled by default) — Enables llmp compression using GZipllmp_debug— Enables debug output for LLMP (also needs aloggerinstalled)llmp_small_maps(enabled by default) — Reduces the initial map size for llmpnautilus— Grammar mutator.nautilus_py— Python grammar support for nautiluslua_mutator— Lua Mutator support (mutators implemented in Lua)simd(enabled by default) — Use the best SIMD implementation by our benchmark
Re-exports§
Modules§
- common
- This module defines trait shared across different
LibAFLmodules - corpus
- Corpuses contain the testcases, either in memory, on disk, or somewhere else.
- events
- An
EventManagermanages all events that go to other instances of the fuzzer. The messages are commonly information about new Testcases as well as stats and otherEvents. - executors
- Executors take input, and run it in the target.
- feedbacks
- The feedbacks reduce observer state after each run to a single
is_interesting-value. If a testcase is interesting, it may be added to a Corpus. - fuzzer
- The
Fuzzeris the main struct for a fuzz campaign. - generators
- Generators may generate bytes or, in general, data, for inputs.
- inputs
- Inputs are the actual contents sent to a target for each exeuction.
- monitors
- Keep stats, and display them to the user. Usually used in a broker, or main node, of some sort.
- mutators
Mutatorsmutate input during fuzzing.- observers
- Observers give insights about runs of a target, such as coverage, timing, stack depth, and more.
- prelude
- The purpose of this module is to alleviate imports of many components by adding a glob import.
- schedulers
- Schedule the access to the Corpus.
- stages
- A
Stageis a technique used during fuzzing, working on onecrate::corpus::Corpusentry, and potentially altering it or creating new entries. A well-knownStage, for example, is the mutational stage, running multiplecrate::mutators::Mutators against acrate::corpus::Testcase, potentially storing new ones, according tocrate::feedbacks::Feedback. Other stages may enrichcrate::corpus::Testcases with metadata. - state
- The fuzzer, and state are the core pieces of every good fuzzer
Macros§
- feedback_
and - Variadic macro to create a chain of
AndFeedback - feedback_
and_ fast - Variadic macro to create a chain of (fast)
AndFeedback - feedback_
not - Variadic macro to create a
NotFeedback - feedback_
or - Variadic macro to create a chain of
OrFeedback - feedback_
or_ fast - Combines multiple feedbacks with an
ORoperation, not executing feedbacks after the first positive result - impl_
default_ multipart - Implements the marker trait
super::DefaultMultipartMutatorfor one to many types, e.g.: - mark_
feature_ time - Mark the elapsed time for the given feature
- mark_
feedback_ time - Mark the elapsed time for the given feature
- none_
input_ converter Nonetype to satisfy the type infearence in anOption- nonzero
- Zero-cost way to construct
core::num::NonZeroUsizeat compile-time. - random_
corpus_ id - Utility macro to call
Corpus::random_id; fetches only enabledTestcases - random_
corpus_ id_ with_ disabled - Utility macro to call
Corpus::random_id; fetches both enabled and disabledTestcasesNote: useCorpus::get_from_allas disabled entries are inaccessible fromCorpus::get - require_
index_ tracking - Use in the constructor of your component which requires index tracking of a
super::MapObserver. Seesuper::CanTrackfor details. - require_
novelties_ tracking - Use in the constructor of your component which requires novelties tracking of a
super::MapObserver. Seesuper::CanTrackfor details on the concept. - start_
timer - Start the timer
Enums§
- Error
- Main error struct for
LibAFL