Skip to content

Instantly share code, notes, and snippets.

@B3nac
Last active May 15, 2024 08:26
Show Gist options
  • Save B3nac/1fb19ed11ea24de2ac6a0f62cc4fc6e0 to your computer and use it in GitHub Desktop.
Save B3nac/1fb19ed11ea24de2ac6a0f62cc4fc6e0 to your computer and use it in GitHub Desktop.
How to setup winafl on Windows 10

Clone winafl

git clone https://github.com/googleprojectzero/winafl.git

If needing Intel processor support

git submodule update --init --recursive

Download Visual Studio 15 2017 and install "Desktop development with C++"

  1. Open Visual Studio
  2. Go to Tools -> Get Tools and Features
  3. In the "Workloads" tab enable "Desktop development with C++"
  4. Click Modify at the bottom right

Install cmake for Windows

https://cmake.org/download/

Download DynamoRIO Needs to be recent version to support Windows 10

https://github.com/DynamoRIO/dynamorio/releases

What I used: https://github.com/DynamoRIO/dynamorio/releases/download/cronbuild-7.91.18278/DynamoRIO-Windows-7.91.18278-0.zip

Place the unzipped folder into the cloned winafl directory.

Build winafl

  1. cd into cloned winafl directory

  2. mkdir build64

  3. cmake -G"Visual Studio 15 2017 Win64" .. -DDynamoRIO_DIR=C:\Users\B3nac\Documents\winafl\DynamoRIO-Windows-7.91.18278-0\cmake -DINTELPT=1

  4. cmake --build . --config Release

Example commands

  1. cd into build64\bin\Release

afl-fuzz.exe -i in -o out -D C:\Users\B3nac\Documents\winafl\DynamoRIO-Windows-7.91.18278-0\bin64 -t 20000 -- -coverage_module test.exe -fuzz_iterations 5000 -target_module test.exe -target_offset 0x1000 -nargs 2 -- test.exe @@

afl-fuzz.exe -i in -o out -D C:\Users\B3nac\Documents\winafl\DynamoRIO-Windows-7.91.18278-0\bin64 -t 100+ -- -coverage_module test.exe -fuzz_iterations 5000 -target_module test.exe -target_offset 0x1000 -persistence_mode in_app -- test.exe @@ loop

Example debug command

C:\Users\B3nac\Documents\winafl\DynamoRIO-Windows-7.91.18278-0\bin64\drrun.exe -c C:\Users\B3nac\Documents\winafl\build64\bin\Release\winafl.dll -debug -target_module C:\Users\B3nac\Documents\winafl\bin64\bin\Release\test.exe -target_offset 0x13a0 -- test.exe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment