A harness is a thin C program that bridges AFL++ and your target library or protocol implementation. AFL++ calls the harness asDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/AdithyaaSivamal/Agentic-AFL/llms.txt
Use this file to discover all available pages before exploring further.
./harness @@, where @@ is replaced by the path to each mutated input file — the harness receives that path as argv[1], opens the file, and passes its bytes to the target function. Agentic-AFL watches the harness’s output for a configurable accept marker that signals the math or crypto validation wall has been bypassed. Before running any campaign, you need a correctly written and compiled harness — getting this step right determines how much of your target’s state machine the fuzzer can explore.
Harness Requirements
Every Agentic-AFL harness must satisfy three constraints:Accept input from argv[1]
AFL++ passes the mutated input file path as the first command-line argument (the
@@ placeholder). The harness must open argv[1], read it, and pass the bytes to the target function. Do not read from stdin — Agentic-AFL does not use deferred fork-server stdin mode.Compile with afl-cc
The binary must be instrumented with AFL++‘s edge-coverage instrumentation. Compile with
afl-cc (which wraps clang or gcc). Without instrumentation, AFL++ cannot measure coverage and the stall detector has no edge signal to monitor.Print the accept marker on bypass
When the target’s validation logic accepts the input (i.e., the math or CRC wall is passed), the harness must print the accept marker to stdout or stderr. The default marker is
ACCEPT. Agentic-AFL polls the AFL++ queue to detect when an injected payload triggers this marker, confirming a successful bypass.Example Harness Structure
Replaceprocess_packet with your actual parser or validator. The structure below is minimal and correct for Agentic-AFL:
harness.c
ACCEPT) must be flushed to stdout before the process exits. printf followed by process exit is sufficient — fflush is not required since the C runtime flushes stdout buffers on normal exit.
Compiling with afl-cc
afl-showmap:
Providing Seed Inputs
Seed quality directly affects how quickly AFL++ reaches the stall site. Seeds should be:Minimal valid frames
Use the smallest complete packet or frame that passes all pre-validation checks up to (but not including) the math/crypto wall. Larger seeds slow down mutation without adding coverage.
One per frame type
Provide at least one seed per protocol frame type or message class. AFL++‘s corpus covers one code path per seed — a single seed for a multi-type protocol leaves entire dispatch branches unreachable.
Custom Accept Marker
The marker that Agentic-AFL watches for can be changed with--accept-marker. This is useful when the target already prints protocol-specific strings on success, or when you want to distinguish bypass events from unrelated stdout output: