custom_mutators/zmq/README.md
This custom mutator is copied from AIXCC Team Atlanta.
This is a custom mutator for AFL++ that receives seed IDs from a ZMQ router and reads actual seed content from shared memory pools.
/dev/shm/<shm_name>)The mutator implements a sophisticated architecture:
The shared memory pools follow this layout:
Header (8 bytes):
- item_size (4 bytes, uint32, little-endian)
- item_num (4 bytes, uint32, little-endian)
Items (item_size * item_num bytes):
Each item:
- data_len (4 bytes, uint32)
- payload (data_len bytes)
Prerequisites:
make libzmqmutator.so
Set the custom mutator library when running AFL++:
AFL_CUSTOM_MUTATOR_LIBRARY=/path/to/libzmqmutator.so afl-fuzz [options]
The mutator can be configured via environment variables:
AFL_ZMQ_ROUTER: ZMQ router address (default: "ipc:///tmp/haha")AFL_ZMQ_HARNESS: Harness name to identify this fuzzer (optional)The harness name is determined in the following priority order:
/proc/self/exe (Linux only)AFL_ZMQ_HARNESS environment variableThe mutator will automatically extract just the binary name from full paths (e.g., /usr/bin/target becomes target).
Example:
export AFL_ZMQ_ROUTER="tcp://127.0.0.1:5555"
export AFL_ZMQ_HARNESS="MyTarget" # Optional, will auto-detect if not set
AFL_CUSTOM_MUTATOR_LIBRARY=./libzmqmutator.so afl-fuzz -i in -o out ./target @@
The mutator implements the following protocol:
Heartbeat: Sent every 5 seconds
Seed Reception:
Acknowledgment:
The seed bundle contains references to seeds in shared memory:
{
"script_id": 123,
"harness_name": "MyTarget",
"shm_name": "seed_pool_001",
"seed_ids": [0, 1, 2, 3, 4]
}
shm_name: Name of the shared memory pool in /dev/shm/seed_ids: Array of seed indices within the shared memory poolThis design ensures that fuzzing only occurs with seeds from the ZMQ router, maintaining full control over the fuzzing inputs.
The mutator tracks and reports:
shm_name is encountered