A Windows binary fuzzer written in C that mutates an input configuration file, runs a target executable, collects code coverage with DynamoRIO/drcov, and logs crashes with exception details.
This project implements a simple coverage-guided fuzzer for testing Windows binaries. The fuzzer modifies bytes in the input file, executes the target program, tracks basic block coverage, detects crashes, and saves useful debugging information such as exception codes, register values, and stack snapshots.
- Single-byte mutation mode
- Multi-byte mutation mode
- Manual and automatic fuzzing modes
- Input file backup and restoration
- Payload region detection and exclusion
- Code coverage collection with DynamoRIO/drcov
- Crash detection through Windows exception codes
- Register and stack dump logging
- Coverage improvement tracking
- Fuzzing progress output
- C
- Windows API
- DynamoRIO
- drcov
- Win32 debugging API
.
├── fuzzer.c # Main fuzzer source code
├── config_13 # Input file used for mutation
├── config_13_bak # Backup of the original input file
├── func.dll # Target dependency
├── vuln13.exe # Target executable
└── fuzz_log.txt # Fuzzing log output
The fuzzer follows these steps:
- Loads the original input file.
- Creates a backup copy.
- Detects the payload region that should not be mutated.
- Applies byte-level mutations to the input file.
- Runs the target executable.
- Collects coverage information using DynamoRIO/drcov.
- Checks the process exit code and Windows exceptions.
- Logs crashes, register values, stack snapshots, and coverage changes.
- Restores the input file when needed.
The fuzzer supports several mutation patterns:
-
Single-byte replacement:
0x000x010x7F0x800xFE0xFF- space character
-
Multi-byte replacement:
0x00000xFFFF0x7FFF0x80000x0000000xFFFFFF0x000000000xFFFFFFFFAAAA
- Windows
- C compiler with WinAPI support
- DynamoRIO installed
- 32-bit target executable
Before running, update the DynamoRIO path in fuzzer.c:
static char DYNAMORIO_PATH[MAX_PATH] = "D:\\DynamoRIO-Windows-11.3.0-1\\bin32\\drrun.exe";Using Microsoft Visual Studio Developer Command Prompt:
cl fuzzer.cOr with MinGW:
gcc fuzzer.c -o fuzzer.exeRun the compiled fuzzer:
fuzzer.exeThe program provides an interactive console menu for choosing mutation modes and displaying fuzzing results.
The fuzzer writes results to:
fuzz_log.txt
The log may include:
- mutation description
- exception code
- coverage block count
- register values
- stack dump
- crash information