Giter VIP home page Giter VIP logo

winafl's Introduction

WinAFL

   Original AFL code written by Michal Zalewski <[email protected]>

   Windows fork written and maintained by Ivan Fratric <[email protected]>

   Copyright 2016 Google Inc. All Rights Reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

Background

AFL is a popular fuzzing tool for coverage-guided fuzzing. The tool combines fast target execution with clever heuristics to find new execution paths in the target binary. It has been successfully used to find a large number of vulnerabilities in real products. For more info about the original project, please refer to the original documentation at:

http://lcamtuf.coredump.cx/afl/

Unfortunately, the original AFL does not work on Windows due to very *nix-specific design (e.g. instrumentation, forkserver etc.). This project is a fork of AFL that uses different instrumentation approach which works on Windows even for black box binary fuzzing.

The WinAFL approach

Instead of instrumenting the code at compilation time, WinAFL supports the following instrumentation modes:

These instrumentation modes are described in more detail in the separate documents.

afl-fuzz.exe

To improve the process startup time, WinAFL relies heavily on persistent fuzzing mode, that is, executing multiple input samples without restarting the target process. This is accomplished by selecting a target function (that the user wants to fuzz) and instrumenting it so that it runs in a loop.

Known CVEs

WinAFL has been successfully used to identify bugs in Windows software, such as the following:

Software Bugs Found by
Adobe CVE-2018-4985, CVE-2018-5063, CVE-2018-5064, CVE-2018-5065, CVE-2018-5068, CVE-2018-5069, CVE-2018-5070, CVE-2018-12754, CVE-2018-12755, CVE-2018-12764, CVE-2018-12765, CVE-2018-12766, CVE-2018-12767, CVE-2018-12768, CVE-2018-12839, CVE-2018-12840, CVE-2018-12848, CVE-2018-12849, CVE-2018-12850, CVE-2018-12857, CVE-2018-12859, CVE-2018-12860, CVE-2018-12861, CVE-2018-12862, CVE-2018-12863, CVE-2018-12864, CVE-2018-12865, CVE-2018-12866, CVE-2018-12867, CVE-2018-12869, CVE-2018-12870, CVE-2018-12871, CVE-2018-12872, CVE-2018-12873, CVE-2018-12874, CVE-2018-12875, CVE-2018-15927, CVE-2018-15928, CVE-2018-15929, CVE-2018-15930, CVE-2018-15931, CVE-2018-15932, CVE-2018-15933, CVE-2018-15934, CVE-2018-15935, CVE-2018-15936, CVE-2018-15937, CVE-2018-15938, CVE-2018-15952, CVE-2018-15953, CVE-2018-15954, CVE-2018-15955, CVE-2018-15956 Yoav Alon (@yoavalon) and Netanel Ben-Simon (@NetanelBenSimon) of Check Point Software Technologies
Adobe CVE-2018-12853, CVE-2018-16024, CVE-2018-16023, CVE-2018-15995 Guy Inbar (@guyio_)
Adobe CVE-2018-16004, CVE-2018-16005, CVE-2018-16007, CVE-2018-16009, CVE-2018-16010, CVE-2018-16043, CVE-2018-16045, CVE-2018-16046, CVE-2018-19719, CVE-2018-19720, CVE-2019-7045 Sebastian Apelt (@bitshifter123)
Microsoft CVE-2016-7212 Aral Yaman of Noser Engineering AG
Microsoft CVE-2017-0073, CVE-2017-0190, CVE-2017-11816, CVE-2018-8472, CVE-2019-1311 Symeon Paraschoudis (@symeonp)
Microsoft CVE-2018-8494 Guy Inbar (@guyio_)
Microsoft CVE-2018-8464 Yoav Alon (@yoavalon) and Netanel Ben-Simon (@NetanelBenSimon) of Check Point Research
Microsoft CVE-2019-0538, CVE-2019-0576, CVE-2019-0577, CVE-2019-0579, CVE-2019-0580, CVE-2019-0879, CVE-2019-0889, CVE-2019-0891, CVE-2019-0899, CVE-2019-0902, CVE-2019-1243, CVE-2019-1250, CVE-2020-0687, CVE-2020-0744, CVE-2020-0879, CVE-2020-0964, CVE-2020-0995, CVE-2020-1141, CVE-2020-1145, CVE-2020-1160, CVE-2020-1179, CVE-2021-1665 Hardik Shah (@hardik05) of McAfee
Microsoft CVE-2021-42276, CVE-2021-28350, CVE-2021-28349, CVE-2021-28348 Simon Barsky (expend20)
Microsoft CVE-2022-21903, CVE-2022-21904, CVE-2022-21915, CVE-2022-26934, CVE-2022-29112, CVE-2022-35837, CVE-2022-34728, CVE-2022-38006 Gábor Selján
Microsoft CVE-2021-38665, CVE-2021-38666 Valentino Ricotta with Thalium
Microsoft CVE-2022-26929, CVE-2022-30130 Eran Zimmerman Gonen (@3r4nz)
FreeRDP CVE-2021-37594, CVE-2021-37595 Valentino Ricotta with Thalium
Kollective CVE-2018-11672 Maksim Shudrak (@MShudrak) of Salesforce
Mozilla CVE-2018-5177 Guy Inbar (@guyio_)
libxml2 CVE-2018-14404 Guy Inbar (@guyio_)
WinRAR CVE-2018-20250, CVE-2018-20251, CVE-2018-20252, CVE-2018-20253 Nadav Grossman (@NadavGrossman) of Check Point Software Technologies
XnView CVE-2019-13083, CVE-2019-13084, CVE-2019-13085, CVE-2019-13253, CVE-2019-13254, CVE-2019-13255, CVE-2019-13256, CVE-2019-13257, CVE-2019-13258, CVE-2019-13259, CVE-2019-13260, CVE-2019-13261, CVE-2019-13262 @expend20 and Anton Kukoba of Apriorit
IrfanView CVE-2019-13242, CVE-2019-13243 @expend20 and Anton Kukoba of Apriorit
FastStone CVE-2019-13244, CVE-2019-13245, CVE-2019-13246 @expend20 and Anton Kukoba of Apriorit
ACDSee CVE-2019-13247, CVE-2019-13248, CVE-2019-13249, CVE-2019-13250, CVE-2019-13251, CVE-2019-13252, CVE-2019-15293 @expend20 and Anton Kukoba of Apriorit
Foxit CVE-2019-13330, CVE-2019-13331, CVE-2020-8844 Natnael Samson (@NattiSamson)
Rockwell Automation CVE-2020-12034, CVE-2020-12038 Sharon Brizinov and Amir Preminger of Claroty
F-Secure & WithSecure CVE-2021-33599, CVE-2021-33602, CVE-2021-40836, CVE-2021-40837, CVE-2022-28875, CVE-2022-28876, CVE-2022-28879, CVE-2022-28881, CVE-2022-28882, CVE-2022-28883, CVE-2022-28884, CVE-2022-28886, CVE-2022-28887 @faty420

(Let me know if you know of any others, and I'll include them in the list)

Building WinAFL

  1. If you are building with DynamoRIO support, download and build DynamoRIO sources or download DynamoRIO Windows binary package from https://github.com/DynamoRIO/dynamorio/releases

  2. If you are building with Intel PT support, pull third party dependencies by running git submodule update --init --recursive from the WinAFL source directory

  3. Open Visual Studio Command Prompt (or Visual Studio x64 Win64 Command Prompt if you want a 64-bit build). Note that you need a 64-bit winafl.dll build if you are fuzzing 64-bit targets and vice versa.

  4. Go to the directory containing the source

  5. Type the following commands. Modify the -DDynamoRIO_DIR flag to point to the location of your DynamoRIO cmake files (either full path or relative to the source directory).

For a 32-bit build:

mkdir build32
cd build32
cmake -G"Visual Studio 16 2019" -A Win32 .. -DDynamoRIO_DIR=C:\path\to\DynamoRIO\cmake -DINTELPT=1
cmake --build . --config Release

For a 64-bit build:

mkdir build64
cd build64
cmake -G"Visual Studio 16 2019" -A x64 .. -DDynamoRIO_DIR=C:\path\to\DynamoRIO\cmake -DINTELPT=1
cmake --build . --config Release

Build configuration options

The following cmake configuration options are supported:

Using WinAFL

The command line for afl-fuzz on Windows is different than on Linux. Instead of:

%s [ afl options ] -- target_cmd_line

it now looks like this:

afl-fuzz [afl options] -- [instrumentation options] -- target_cmd_line

The following afl-fuzz options are supported:

  -i dir        - input directory with test cases
  -o dir        - output directory for fuzzer findings
  -t msec       - timeout for each run
  -s            - deliver sample via shared memory
  -D dir        - directory containing DynamoRIO binaries (drrun, drconfig)
  -w path       - path to winafl.dll
  -e            - expert mode to run WinAFL as a DynamoRIO tool
  -P            - use Intel PT tracing mode
  -Y            - enable the static instrumentation mode
  -f file       - location read by the fuzzed program
  -m limit      - memory limit for the target process
  -p            - persist DynamoRIO cache across target process restarts
  -c cpu        - the CPU to run the fuzzed program
  -d            - quick & dirty mode (skips deterministic steps)
  -n            - fuzz without instrumentation (dumb mode)
  -x dir        - optional fuzzer dictionary
  -I msec       - timeout for process initialization and first run
  -T text       - text banner to show on the screen
  -M \\ -S id   - distributed mode
  -C            - crash exploration mode (the peruvian rabbit thing)
  -l path       - a path to user-defined DLL for custom test cases processing
  -A module     - a module identifying a unique process to attach to

Please refer to the original AFL documentation for more info on these flags.

To see the supported instrumentation flags, please refer to the documentation on the specific instrumentation mode you are interested in (see "Instrumentation modes" below).

How does my target run under WinAFL

When you select a target function and fuzz an application the following happens:

  1. Your target runs normally until your target function is reached.
  2. WinAFL starts recording coverage
  3. Your target function runs until return
  4. WinAFL reports coverage, rewrites the input file and patches EIP so that the execution jumps back to step 2
  5. After your target function runs for the specified number of iterations, the target process is killed and restarted. Note that anything that runs after the target function returns is never reached.

How to select a target function

The target function should do these things during its lifetime:

  1. Open the input file. This needs to happen within the target function so that you can read a new input file for each iteration as the input file is rewritten between target function runs.
  2. Parse it (so that you can measure coverage of file parsing)
  3. Close the input file. This is important because if the input file is not closed WinAFL won't be able to rewrite it.
  4. Return normally (So that WinAFL can "catch" this return and redirect execution. "returning" via ExitProcess() and such won't work)

Instrumentation modes

The following documents provide information on using different instrumentation modes with WinAFL:

Before using WinAFL for the first time, you should read the documentation for the specific instrumentation mode you are interested in. These also contain usage examples.

Attaching to a running process

The DynamoRIO instrumentation mode supports dynamically attaching to running processes. This option can be used to fuzz processes that cannot be directly launched by WinAFL, such as system services.

To use it, specify the -A <module> option to afl-fuzz.exe, where <module> is the name of a module loaded only by the target process (if the module is loaded by more than one process WinAFL will terminate).

WinAFL will attach to the target process, and fuzz it normally. When the target process terminates (regardless of the reason), WinAFL will not restart it, but simply try to reattach. It is assumed that the target process will be restarted by an external script (or by the system itself). If WinAFL will not find the new target process within 10 seconds, it will terminate.

Sample delivery via shared memory

WinAFL supports delivering samples via shared memory (as opposed to via a file, which is the default). This can be enabled by giving -s option to afl-fuzz.exe. Shared memory is faster and can avoid some problems with files (e.g. unable to overwrite the sample file because a target maintains a lock on it). If you are using shared memory for sample delivery then you need to make sure that in your harness you specifically read data from shared memory instead of file. Check a simple harness here:

https://github.com/googleprojectzero/Jackalope/blob/6d92931b2cf614699e2a023254d5ee7e20f6e34b/test.cpp#L41
https://github.com/googleprojectzero/Jackalope/blob/6d92931b2cf614699e2a023254d5ee7e20f6e34b/test.cpp#L111

Corpus minimization

WinAFL includes the windows port of afl-cmin in winafl-cmin.py. Please run the below command to see the options and usage examples:

D:\Codes\winafl>python winafl-cmin.py -h
[...]
Examples of use:
 * Typical use
  winafl-cmin.py -D D:\DRIO\bin32 -t 100000 -i in -o minset -covtype edge -coverage_module m.dll -target_module test.exe -target_method fuzz -nargs 2 -- test.exe @@

 * Dry-run, keep crashes only with 4 workers with a working directory:
  winafl-cmin.py -C --dry-run -w 4 --working-dir D:\dir -D D:\DRIO\bin32 -t 10000 -i in -i C:\fuzz\in -o out_mini -covtype edge -coverage_module m.dll -target_module test.exe -target_method fuzz -nargs 2 -- test.exe @@

 * Read from specific file
  winafl-cmin.py -D D:\DRIO\bin32 -t 100000 -i in -o minset -f foo.ext -covtype edge -coverage_module m.dll -target_module test.exe -target_method fuzz -nargs 2 -- test.exe @@

 * Read from specific file with pattern
  winafl-cmin.py -D D:\DRIO\bin32 -t 100000 -i in -o minset -f prefix-@@-foo.ext -covtype edge -coverage_module m.dll -target_module test.exe -target_method fuzz -nargs 2 -- test.exe @@

 * Typical use with static instrumentation
   winafl-cmin.py -Y -t 100000 -i in -o minset -- test.exe @@

winafl-cmin.py

Custom test cases processing

WinAFL supports third party DLLs that can be used to define custom test-cases processing (e.g. to send test cases over network). To enable this option, you need to specify -l <path> argument. The DLL should export the following two functions:

dll_init()
dll_run(char *data, long size, int fuzz_iterations)
data - content of test case
size - size of test case
fuzz_iterations - defines a current fuzzing iteration number

We have implemented two sample DLLs for network-based applications fuzzing that you can customize for your own purposes.

Network fuzzing

WinAFL's custom_net_fuzzer.dll allows winAFL to perform network-based applications fuzzing that receive and parse network data. There are several options supported by this DLL that should be provided via the environment variable AFL_CUSTOM_DLL_ARGS:

  -a IP address - IP address to send data in
  -U            - use UDP protocol instead of TCP to send data (default TCP)
  -p port       - port to send data in
  -w msec       - delay in milliseconds before actually start fuzzing

For example, if your application receives network packets via UDP protocol at port 7714 you should set up the environment variable in the following way: set AFL_CUSTOM_DLL_ARGS=-U -p 7714 -a 127.0.0.1 -w 1000

You still need to find target function and make sure that this function receives data from the network, parses it, and returns normally. Also, you can use In App Persistence mode described above if your application runs the target function in a loop by its own.

Additionally, this mode is considered as experimental since we have experienced some problems with stability and performance. However, we found this option very useful and managed to find several vulnerabilities in network-based applications (e.g. in Kollective Kontiki listed above).

There is a second DLL custom_winafl_server.dll that allows winAFL to act as a server and perform fuzzing of client-based applications. All you need is to set up the port to listen on for incoming connections from your target application. The environment variable AFL_CUSTOM_DLL_ARGS=<port_id> should be used for this purpose.

Note

In case of server fuzzing, if the server socket has the SO_REUSEADDR option set like the following code, then this may case 10055 error after some time fuzzing due to the accumulation of TIME_WAIT sockets when WinAFL restart the fuzzing process.

setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*)&opt, sizeof(int));

To avoid this, replace the SO_REUSEADDR option by SO_LINGER option in the server source code if available.

setsockopt(s, SOL_SOCKET, SO_LINGER, (char*)&opt, sizeof(int));

Custom mutators

WinAFL supports loading a custom mutator from a third-party DLL. You need to implement dll_mutate_testcase or dll_mutate_testcase_with_energy in your DLL and provide the DLL path to WinAFL via -l <path> argument. WinAFL invokes the custom mutator before all the built-in mutations, and the custom mutator can skip all the built-in mutations by returning a non-zero value. The dll_mutate_testcase_with_energy function is additionally provided an energy value that is equivalent to the number of iterations expected to run in the havoc stage without deterministic mutations. The custom mutator should invoke common_fuzz_stuff to run and make WinAFL aware of each new test case. Below is an example mutator that increments every byte by one:

u8 dll_mutate_testcase(char **argv, u8 *buf, u32 len, u8 (*common_fuzz_stuff)(char**, u8*, u32))
{
    u8 bailout = 0;
    u8 *newbuf;
    u32 i;
    // duplicate the input buffer
    newbuf = malloc(len);
    if (!newbuf) return bailout;
    memcpy(newbuf, buf, len);
    // increment every byte by one and call common_fuzz_stuff for every new test case
    for (i = 0; i < len; i++) {
       newbuf[i] += 1;
       if (common_fuzz_stuff(argv, newbuf, len)) {
           bailout = 1; // skip the rest of the mutation per common_fuzz_stuff
           break;
       }
    }
    free(newbuf);
    return bailout;
}

FAQ

Q: WinAFL reports timeouts while processing initial testcases.
A: You should run your target in debug mode first (-debug flag) and only
   run WinAFL once you get a message in the debug log that everything
   appears to be running normally.

Q: WinAFL runs slower than expected
A: This can commonly happen for several reasons
 - Your target function loads a dll for every iteration. This causes
   DynamoRIO to translate the same code for every iteration which causes
   slowdowns. You will be able to see this in the debug log. To
   resolve, select (or write) your target function differently.
 - Your target function does not close the input file properly, which
   causes WinAFL to kill the process in order to rewrite it. Please refer to
   "How to select a target function" for what a target function should look like.

Q: Can I fuzz DLLs with WinAFL
A: Yes, if you can write a harness that loads a library and runs some
   function within. Write your target function according to "How to select
   a target function" and for best performance, load the dll outside of
   your target function (see the previous question).

Q: Can I fuzz GUI apps with WinAFL
A: Yes, provided that
 - There is a target function that behaves as explained in "How to select
   a target function"
 - The target function is reachable without user interaction
 - The target function runs and returns without user interaction
 If these conditions are not satisfied, you might need to make custom changes
 to WinAFL and/or your target.

Special Thanks

Special thanks to Axel "0vercl0k" Souchet of MSRC Vulnerabilities and Mitigations Team for his contributions!

winafl's People

Contributors

aegiryy avatar b1ack0wl avatar cvspvr avatar eranzim avatar faty42 avatar fouzhe avatar gdynamics avatar gnbon avatar gogo2464 avatar goldstar611 avatar guyio avatar hardik05 avatar hxm-cpp avatar ifratric avatar ivanfratric avatar juanvazquez avatar kmakinator avatar moshekaplan avatar mostafasoliman avatar mxmssh avatar netanel01 avatar nimatla avatar orbenporath avatar salmonx avatar sgabe avatar vient avatar vladermolaev avatar x9090 avatar yoava333 avatar zuypt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

winafl's Issues

Speeding Up Dry Runs?

So I've made some drastic changes to the program I was struggling with before and I've gotten runs down to a fraction of a second. However, now I'm having issues with my dry runs since I have a huge folder of templates.

Is there any way to shorten the dry run? And is there any way to reuse dry run results over the same templates in future runs? (For instance, to speed up a distributed fuzzing system)?

Cannot change input file extensions

Hi, I am fuzzing this soft called VUPlayer. This software requires the file extension to be m3u to work. So I am trying to change the input file name to xxx.m3u otherwise the input file name will be .cur_input and no crash will be made even using a poc input. I am using the following command to achieve this purpose but it seems I failed since it keeps telling me 1 process nudged and Succeeded terminating process with PID xxxx. Am I using the -f option in a bad way?

C:\Program Files (x86)\VUPlayer> afl-fuzz.exe -i in -o out -f test.m3u -D C:\Users\Administrator\Desktop\DynamoRIO-Windows-6.2.0-2\bin32 -t 20000 -- -fuzz_iterations 5000 -coverage_module VUPlayer.exe -target_module VUPlayer.exe -target_offset 0x532a0 -nargs 2 -- UPlayer.exe @@

Target function was never called. Incorrect target_offset?

I have a question about the target_offset for functions other than main.
I wrote a little program which should test myDll.dll

`void fuzz(int argc, char *argv[])
{
FuncWithParams paramFunc;
paramFunc = (FuncWithParams)GetProcAddress(hDLL, "process");
int result = paramFunc(argc, argv);
}

int main(int argc, char *argv[])
{
hDLL = LoadLibrary("myDll.dll");
fuzz(argc, argv);
FreeLibrary(hDLL);
return 0;
}`

In WinDbg I'm getting the target_offset as follow:

ModLoad: 00da0000 00da9000 test.exe

with x test!main = 00da1060 -> offset is 0x1060
with x test!fuzz = 00da1020 -> offset is 0x1020

When I try to run winafl with target_offset 0x1060 (main) everything works fine but it's very slow (because LoadLibrary is called every time) !
When I try to run winafl with target_offset 0x1020 (fuzz) I'm getting an error that the initial testcase caused a hang -> drun -debug log says: Target function was never called. Incorrect target_offset?

What I'm doing wrong ?

Changing the Memory Limit

Hello ivanfratric

How would one go about changing the memory limit of the WinAFL tool.

Would changing the memory limit in config.h work?

/* Default memory limit for child process (MB): */
55  
56  #ifndef __x86_64__ 
57  #  define MEM_LIMIT         25
58  #else
59  #  define MEM_LIMIT         50
60  #endif /* ^!__x86_64__ */

Approch for winafl same offset for different modules and analyzing hangs

hi @ifratric @ivanfratric

i have 2 questions regarding winafl

  1. suppose i have binary test in which i have 2 modules test1.dll and test2.dll which coincidentally have same offset for different functions like 0202221111 and 303331111 which will be 1111 in both cases which gives us instrumentation data and is fuzzable how to identify which is the correct one
    how can we follow the approach i think its a silly question but still had a doubt so asked .

  2. how to analyze hangs and crashes with winafl

Program always fails due to hang

Before I run the afl-fuzz I am able to run my target executable with drrun.exe. But no matter what I do with the timeout passed to afl-fuzz.exe, the test case always results in a hang. Any suggestions to check out?

Debug Error! Popup window

Hello ivanfratric

So I'm just starting out working with winafl, and I wanted to test it out on a simple binary (which has obvious segmentation faults) just so I can understand the process.

While testing winafl on the following simple target:

 #include "stdafx.h"
 int copy_content_from_xml (const char* filename, char* content);

 int main(int argc, char ** argv)
 {
    char *p_args_file; /* String representing XML configuration files */
    char buffer1[2] = {0};
    char buffer2[2] = {0};
    int output = 0;
    if(argc > 1)
    {
        p_args_file = argv[1];
    }
    else
    {
        return 0;
    }

    copy_content_from_xml(p_args_file, buffer1);

    if(buffer1[0] > 98)
    {
        buffer1[2] = 'a';  // Writing out of bound - buffer overflow
        output = buffer2[0];
    }

     if(buffer1[0] < 120)
    {
        output = buffer1[3];  // Reading out of access bound
        buffer1[0] = 'x';  // Writing out of bound - buffer overflow

    }


    return output;
}
int
copy_content_from_xml (const char* filename, char* content) {
    /* Allocate memory for context */
     FILE *fp; /* the XML file */
     int i;
     /* Open file */
     fp =  fopen(filename, "r");
     if (fp == NULL) 
    {
        //fprintf(stderr, "Error: Failed to open '%s'!\n", filename);
        return 0;
    }
   fgets(content, 2, fp);
   fclose(fp);
}

The following window always pops-up, everytime a process is being run, which significantly reduces the execution speed.
image

Is winafl supposed to generate a pop-up window everytime it discovers a hang? That seems inefficient.

problems about building WinAFL

Hello, ivanfratric
When building WinAFL with visual studio 2010, I got lots of C2664 ERRORs about the conversion from “u8 *” to “const char *”. So I replace the
typedef uint8_t u8;
with
typedef char u8;.
However, as a result, I get a lot of problems when testing the generated EXE. And when I build it using dev c++ with gcc, I find the generated EXE get much larger than the original EXE. Meanwhile, the speed of fuzzing also slow down. Do you have any suggestions to solve the problems?

Port afl-cmin to Windows

Looking to try converting the remaining afl tools over to windows. I've looked at afl-cmin and with it being bash I'm thinking it may be plausible to port it into Python or another Windows suitable language. What do you think?

INSTR_CREATE_mov_st in instrument_edge_coverage

I am learning DynamoRIO along with winafl usage so my debugging skills in the DR environment are still lame, I apologize for not having a solid proof of what I am asking.

In the function instrument_edge_coverage

You have the following code but there is no instrlist_meta_preinsert call afterwards like in the other instructions, is this how it's supposed to be? Are we not updating the previous_offset at the end?

//store the new value
offset = (offset >> 1)&(MAP_SIZE - 1);
opnd1 = OPND_CREATE_ABSMEM(&(winafl_data.previous_offset), OPSZ_4);
opnd2 = OPND_CREATE_INT32(offset);
INSTR_CREATE_mov_st(drcontext, opnd1, opnd2);

Not seeing new Paths

Hi Ivan,

Do you know what could be the issue that I am running the Fuzzer for 9 hours and no new paths are getting discovered, I also have WinAFL running on another application and the behaviour is the same.
Please Advise.

            WinAFL 1.03 based on AFL 1.96b 

+- process timing -------------------------------------+- overall results ----+
| run time : 0 days, 9 hrs, 30 min, 22 sec | cycles done : 35.0k |
| last new path : none yet (odd, check syntax!) | total paths : 1 |
| last uniq crash : none seen yet | uniq crashes : 0 |
| last uniq hang : none seen yet | uniq hangs : 0 |
+- cycle progress --------------------+- map coverage -+----------------------+
| now processing : 0 (0.00%) | map density : 37 (0.06%) |
| paths timed out : 0 (0.00%) | count coverage : 1.00 bits/tuple |
+- stage progress --------------------+ findings in depth --------------------+
| now trying : havoc | favored paths : 1 (100.00%) |
| stage execs : 495/500 (99.00%) | new edges on : 1 (100.00%) |
| total execs : 17.5M | total crashes : 0 (0 unique) |
| exec speed : 990.0/sec | total hangs : 0 (0 unique) |
+- fuzzing strategy yields -----------+---------------+- path geometry -------+
| bit flips : 0/32, 0/31, 0/29 | levels : 1 |
| byte flips : 0/4, 0/3, 0/1 | pending : 0 |
| arithmetics : 0/224, 0/0, 0/0 | pend fav : 0 |
| known ints : 0/24, 0/101, 0/40 | own finds : 0 |
| dictionary : 0/0, 0/0, 0/0 | imported : n/a |
| havoc : 0/17.5M, 0/0 | variable : 0 |
| trim : 97.80%/13, 0.00% +-----------------------+
[] Entering queue cycle 35014.-----------------------+
[
] Fuzzing test case #0 (1 total)...

division-by-zero ignored?

https://github.com/ivanfratric/winafl/blob/master/winafl.c#L175

It seems that exception 0xC0000094 (division-by-zero) is ignored by winafl which will cause hangs and a window will be prompted by WerFault.exe.

Will we consider handle this exception?

Thanks.

System Error: Unable to create 'out\.cur_input'

Hello ivanfratric

I installed WinAFL and it mostly seems to be running well. However after the WinAFL runs for some time, I get the following System Error message.

image

I am running the WinAFL tool as an Administrator, so I do not know why the OS denies permission.

Any thoughts?

why need target_offset ?

i think it's difficult to choose a offset .it seems afl does not need offset, why winalf not use static instrumentation with compiler?

winafl deletes previous data when resuming incorrectly closed session

After days of fuzzing i finally found a BEX in unrar. But AFL didn't seem to catch it and just hung.
Long story short, forgot to make a dump and resumed AFL.
AFL deleted /queue/* and started looking for the /_resume. Which wasn't there because the last session closed forcefully. By then everything, including the last few permutations that lead to the access violation seem to be lost forever. Starting again, hoping to rediscover them....

Output:

[] Setting up output directories...
[+] Output directory exists, will attempt session resume.
[
] Deleting old session data...
[+] Output dir cleanup successful.
[*] Scanning '../../unrar/o_resume'...

[-] The input directory does not seem to be valid - try again. The fuzzer needs
one or more test case to start with - ideally, a small file under 1 kB
or so. The cases must be stored as regular files directly in the input
directory.

[-] SYSTEM ERROR : Unable to open '../../unrar/o_resume'
Stop location : read_testcases(), ..\afl-fuzz.c:1367
OS message : No such file or directory

PS: still in love with your code but as you can imagine this is frustrating as hell

Fail to fuzz imagemagick convert

Hi, ivan,
When I fuzzed the iamgemagick convert with using the command
afl-fuzz -i input_dir -o output_dir -D path/to/Dynamorio/bin32 -t 20000 -- coverage_module convert.exe -fuzz_iterations 5000 -target_module convert.exe -target_offset 0xa291e -nargs 3 -- convert.exe @@ out.ipg
I got an error that
PROGRAM ABORT: test case result in a hang when perform_dry_run().

0xa291e is the export entry of main() function, I got it from IDA pro.

I wonder whether the command is correct or not? When I typed the command convert a.png a.jpg in the console, I got the correct result. So I need your help.

What's target_offset referrd to?

Hello :)
It's a question when winafl is used to fuzz about the following parameter:
-target_offset - offset of the method to fuzz from the start of the module.

It confused me in the following situations:

  1. It could refer to the offset to the module in the executive file.
  2. It could refer to the offset to the module in the running process memory.
    In those situations target_offset could be different. By reading the source code, I think it might be the 2nd one. But I'm not sure, is that correct?And it might be related to the implementation of DynamoRIO?

Thanks very much!

PROGRAM ABORT: CreateProcess failed, GLE=2

Hi, im trying to run WinAFL and I get this error:

C:\Users\fuzz\Desktop\winafl-master\winafl-master\bin32>afl-fuzz.exe -i in -o ou
t -D C:\Users\fuzz\Desktop\DynamoRIO-Windows-7.0.0-RC1\bin32\drrun.exe -t 20000
-- -fuzz_iterations 5000 -coverage_module "foxitreader.exe" -target_module "foxi
treader.exe" -target_offset 0x5d22a6 -nargs 2 -- "C:/Program Files (x86)/Foxit S
oftware/Foxit Reader/foxitreader.exe" @@
WinAFL 1.08 by [email protected]
Based on AFL 1.96b by [email protected]
[] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[
] Deleting old session data...
[+] Output dir cleanup successful.
[] Scanning 'in'...
[+] No auto-generated dictionary tokens to reuse.
[
] Creating hard links for all input files...
[*] Attempting dry run with 'id_000000'...

[-] PROGRAM ABORT : CreateProcess failed, GLE=2.

     Location : create_target_process(), ..\afl-fuzz.c:2074

I get that it can't create the process i want to run, but not sure how to fix this.
Thanks.

P.S first time running WinAFL.
Update: still digging around and I think, speking under correction, it has to do with file system redirection? I'm using Windows 7 x64. If anybody could assist, I will be greatful. Thanks

ddrun.exe and alf_fuzz.exe seems to hang.

Hi Ivan,
I am testing your fuzzing tool, i am not sure if I am doing it correctly, but I have tried on Windows XP and Windows 7 both 32 bits, when I start testing it using the drrun.exe or alf_fuzz.exe they seems to hang and it is not getting released, I left it running for hours, please see the screenshot below, I enabled -debug, but I don't see anything wrong.
Another question, Windows XP is supported ?
Please Advise.

screen shot 2016-12-21 at 3 05 29 pm

Loading extra dictionary fails

I try to us a dictionary but I get an error message:

C:\winafl\build32\Debug>afl-fuzz.exe -x dict -i in -o out -D C:\DynamoRIO-Windows-6.2.0-2\bin32 -t 2000 -- -coverage_module test.exe -fuzz_iteration
s 1000 -target_module test.exe -target_offset 0x31A80 -nargs 2 -- test.exe @@

WinAFL 1.02 by [email protected]
Based on AFL 1.96b by [email protected]
[] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[
] Deleting old session data...
[+] Output dir cleanup successful.
[] Scanning 'in'...
[+] No auto-generated dictionary tokens to reuse.
[
] Creating hard links for all input files...
[*] Loading extra dictionary from 'dict' (level 0)...

[-] SYSTEM ERROR : Unable to access 'dict\test.txt'
Stop location : load_extras(), C:\winafl\afl-fuzz.c:1636
OS message : No such file or directory

I created a file in the dict directory but it seems that WinAFL is looking for test.txt which is the input file ... What I'm doing wrong ?

Instrumentation output varies across runs.

Hi Ivan

While resuming a 7zip fuzzing session i noticed a lot of the files in the queue did not trigger new paths in the dry run. Upon inspecting the output it shows that with a lot of test cases the instrumentation varies per iteration, see below.

Is this maybe noise from translation of DR to AFL? Or could it point to something significant in the program being fuzzed ? For now it seems to be giving a lot of false positives in discovered paths.



    len = 54, map size = 2986, exec speed = 49926 us
[!] WARNING: No new instrumentation output, test case may be useless.
[!] WARNING: Instrumentation output varies across runs.
[*] Attempting dry run with 'id_000161'...


---


 len = 77, map size = 3684, exec speed = 78417 us
[!] WARNING: No new instrumentation output, test case may be useless.
[!] WARNING: Instrumentation output varies across runs.
[*] Attempting dry run with 'id_000163'...

---

  len = 2, map size = 2964, exec speed = 26817 us
[!] WARNING: No new instrumentation output, test case may be useless.
[*] Attempting dry run with 'id_000164'...

---

    len = 7, map size = 2986, exec speed = 33316 us
[!] WARNING: No new instrumentation output, test case may be useless.
[*] Attempting dry run with 'id_000167'...


---

    len = 60, map size = 2970, exec speed = 30770 us
[!] WARNING: No new instrumentation output, test case may be useless.
[*] Attempting dry run with 'id_000168'...

---

    len = 17, map size = 2970, exec speed = 29740 us
[!] WARNING: No new instrumentation output, test case may be useless.
[*] Attempting dry run with 'id_000169'...

----

    len = 77, map size = 3355, exec speed = 52465 us
[!] WARNING: No new instrumentation output, test case may be useless.
[!] WARNING: Instrumentation output varies across runs.
[*] Attempting dry run with 'id_000170'...


---

    len = 15, map size = 3354, exec speed = 38017 us
[!] WARNING: No new instrumentation output, test case may be useless.
[*] Attempting dry run with 'id_000171'...

---

[!] WARNING: No new instrumentation output, test case may be useless.
[!] WARNING: Instrumentation output varies across runs.

winafl-cmin.py issues

hey all,
I'm trying to use the winafl-cmin.py file for corpus distillation but I'm having troubles running it.
Here's the command I tried and the result:

python winafl-cmin.py -i "C:\Users\john\Desktop\results\seed_files" -o "C:\Users\john\Desktop\results\syncdir" -coverage_module shimgvw.dll -target_module PhotoViewerLoader.exe -nargs 2 -D "C:\users\john\Desktop\DynamoRIO-Windows-6.2.0-2\bin32\" -target_offset 0x1040 -t 10000 -- PhotoViewerLoader.exe @@

corpus minimization tool for WinAFL by <[email protected]> Based on WinAFL by <[email protected]> Based on AFL by <[email protected]> usage: winafl-cmin.py [-h] -i dir -o dir [-n] [--working-dir dir] [-v] [-covtype {edge,bb}] [-call_convention {stdcall,fastcall,thiscall,ms64}] -coverage_module module -target_module module -nargs nargs -D dir (-target_method method | -target_offset rva offset) [-t msec] [-f file] [-C] [-e] [-w n] ...
winafl-cmin.py: error: one of the arguments -target_method -target_offset is required

Running WinAFL with the -target_offset is working fine so I can't really tell what I'm missing here. Any help would be appreciated!
Thanks,
doria90

Quotes stripped out of module arguments

afl-fuzz appears to be stripping quotes out of the module arguments. This makes it impossible to test modules located in file paths that contain spaces. For instance:

C:\Users\akirilov\Desktop\test3>afl-fuzz.exe -i "inputs_small" -o "outputs" -D "C:\DynamoRIO-Windows-6.1.1-3\bin64" -t 20000 -- -coverage_module (redacted) -coverage_module (redacted) -coverage_module (redacted) -fuzz_iterations 20000 -target_module (redacted) -target_offset 0x11AC -nargs 2 -- "C:\Program Files\(redacted)" @@
WinAFL 1.01 by <[email protected]>
Based on AFL 1.96b by <[email protected]>
[*] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[*] Deleting old session data...
[+] Output dir cleanup successful.
[*] Scanning 'inputs_small'...
[+] No auto-generated dictionary tokens to reuse.
[*] Creating hard links for all input files...
[*] Attempting dry run with 'id_000000'...
ERROR: Failed to create process for "C:\Program": The system cannot find the file specified.

How to fuzz the Dynamic-link library with winafl

Is it possible to fuzz the dll which the the program will load?
the program cpp code like:
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
int main()
{ HMODULE m = LoadLibraryA("C:\path\a.dll");
PGNSI a= (PGNSI)GetProcAddress(m, "GetInfo");
//printf("0x%p\n", m);
//printf("0x%p\n", a);
return 0;
}
I want to fuzz all the functions exposed by dll file (like a.dll), but in this way it does not work when i got the address to calculate the target_offset by GetProcAddress.
Error log: WARNING: Target function was never called. Incorrect target_offset?
Could you give some advice how to fuzz the dll with winafl ( if it is possible)?

nargs question

Hi Ivan,

Wanted to ask you how do you figure out the number of arguments passed to the target method when you have nothing but the binary, without symbols. I know that, for example, x64 programs follow this calling convention, so we can potentially induce parameter count from that, but can we always count on register and stack being set up immediately before the call, or is there some other trick?

Also, what are the consequences of using the wrong number arguments passed to the target method?

The program took more than 60000 ms to process one of the initial test cases.

Getting the following error:

C:\Users\akirilov\Desktop\test3>afl-fuzz.exe -i "inputs_small" -o "outputs" -D "C:\DynamoRIO-Windows-6.2.0-2\bin64" -t 60000 -f (redacted) -- -coverage_module (redacted) -coverage_module (redacted) -coverage_module (redacted) -fuzz_iterations 1 -target_module (redacted) -target_offset 0x11AC -nargs 2 -- "C:\xxxx\xxxx\(redacted)" (redacted)
WinAFL 1.02 by <[email protected]>
Based on AFL 1.96b by <[email protected]>
[*] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[*] Deleting old session data...
[+] Output dir cleanup successful.
[*] Scanning 'inputs_small'...
[+] No auto-generated dictionary tokens to reuse.
[*] Creating hard links for all input files...
[*] Attempting dry run with 'id_000000'...

[-] The program took more than 60000 ms to process one of the initial test cases.
    Usually, the right thing to do is to relax the -t option - or to delete it
    altogether and allow the fuzzer to auto-calibrate. That said, if you know
    what you are doing and want to simply skip the unruly test cases, append
    '+' at the end of the value passed to -t ('-t 60000+').

[-] PROGRAM ABORT : Test case 'id_000000' results in a hang
         Location : perform_dry_run(), ..\afl-fuzz.c:2511

My modules are just the module name (foo.dll) so not using the full path this time. I see the target program launch and exit cleanly, and it takes significantly less than a minute, yet I still get the same error message no matter how high I set the timeout. I tried without any coverage modules too in case that was the issue, and still no luck.

Fuzzing a network application

Is it possible to fuzz a network application? I do have a python script that is able to send data to the network service and I do know the address of the function that is called for parsing the received data in the target application.
How would I go about doing this?

Thank you.

WARNING: Target function was never called. Incorrect target_offset?

I'm getting the above warning in my output and failing to fuzz, but my offset is correct.

OS: Windows Server 2012 R2 (x64)
WinAFL: Current master
DynamoRIO: 6.1.1-3

Command line: "E:\temp\WinAFL\DynamoRIO-Windows-6.1.1-3\bin64\drrun.exe" -c "E:\temp\WinAFL\winafl-master\bin64\winafl.dll" -debug -target_module "E:\temp\WinAFL\winafl-master\bin64\test_gdiplus.exe" -target_offset 0x1270 -fuzz_iterations 10 -nargs 2 -- "E:\temp\WinAFL\winafl-master\bin64\test_gdiplus.exe" "E:\temp\WinAFL\winafl-master\testcases\images\bmp\not_kitty.bmp"

WinDBG:

0:000> x test_gdiplus!main
00007ff6`92411270 test_gdiplus!main (<no parameter info>)
0:000> u test_gdiplus!main
test_gdiplus!main:
00007ff6`92411270 4053            push    rbx
00007ff6`92411272 4883ec40        sub     rsp,40h
00007ff6`92411276 488bda          mov     rbx,rdx
00007ff6`92411279 83f902          cmp     ecx,2
00007ff6`9241127c 7d18            jge     test_gdiplus!main+0x26 (00007ff6`92411296)
00007ff6`9241127e 488b12          mov     rdx,qword ptr [rdx]
00007ff6`92411281 488d0d28350000  lea     rcx,[test_gdiplus!`string' (00007ff6`924147b0)]
00007ff6`92411288 ff1502710000    call    qword ptr [test_gdiplus!_imp_printf (00007ff6`92418390)]
0:000> !peb
PEB at 00007ff6915d4000
    InheritedAddressSpace:    No
    ReadImageFileExecOptions: No
    BeingDebugged:            Yes
    ImageBaseAddress:         00007ff692410000
    Ldr                       00007ffd804f1320
    Ldr.Initialized:          Yes
    Ldr.InInitializationOrderModuleList: 0000000000792d90 . 00000000007934a0
    Ldr.InLoadOrderModuleList:           0000000000792f40 . 00000000007971d0
    Ldr.InMemoryOrderModuleList:         0000000000792f50 . 00000000007971e0
                    Base TimeStamp                     Module
            7ff692410000 57769e0b Jul 01 09:44:59 2016 E:\temp\WinAFL\winafl-master\bin64\test_gdiplus.exe
...

0x00007ff692411270 - 0x00007ff692410000 = 0x1270

Not sure what else could be causing the issue?

execution speed very slow

I am testing a DLL library by creating a wrapper around that DLL and basically calling functions on it. Everything looks working ok but execution speed is 0.38 exec/sec!! that's pretty bad. Is that normal or I am missing something. I am loading the DLL dynamically using LoadLibrary(), I know that slows the execution a bit but not the level of 0.38 exec/sec

Any ideas?

How to fuzz execution with GUI?

Hello ,I can use winafl to fuzz execution in cmd, and I try to fuzz execution with GUI,but it can't work.
Is it possible to fuzz execution with GUI ? just like some media player(VUPlayer,RealPlayer,and etc.), Document reader( adobe reader, office and etc.), Photo viewer(ACDsee and etc.),and Could you give me some advice how to use winal to fuzz them?
Thank u very much

drrun is not reading fuzz_iterations

c:\work\winafl\DynamoRIO-Windows-6.1.1-3\bin64\drrun.exe -c winafl.dll -debug -target_module notepad.exe -target_offset 0x3a14 -fuzz_iterations 5 -nargs 4 -- C:\Windows\system32\notepad.exe test.txt

runs only one time instead of 5 times

Module loaded, dynamorio.dll
Module loaded, KERNEL32.dll
Module loaded, USER32.dll
Module loaded, ntdll.dll
Module loaded, winafl.dll
Module loaded, drx.dll
Module loaded, drreg.dll
Module loaded, drmgr.dll
Module loaded, drwrap.dll
Module loaded, notepad.exe
Module loaded, WINSPOOL.DRV
Module loaded, COMCTL32.dll
Module loaded, VERSION.dll
Module loaded, KERNELBASE.dll
Module loaded, ADVAPI32.dll
Module loaded, GDI32.dll
Module loaded, SHLWAPI.dll
Module loaded, USP10.dll
Module loaded, MSCTF.dll
Module loaded, SHELL32.dll
Module loaded, RPCRT4.dll
Module loaded, IMM32.dll
Module loaded, SECHOST.dll
Module loaded, msvcrt.dll
Module loaded, COMDLG32.dll
Module loaded, ole32.dll
Module loaded, LPK.dll
Module loaded, OLEAUT32.dll
Module loaded, VERIFIER.dll
Module loaded, CRYPTBASE.dll
Module loaded, UxTheme.dll
Module loaded, dwmapi.dll
In OpenFileW, reading C:\Windows\Fonts\staticcache.dat
In OpenFileW, reading C:\Users\310222344\Downloads\winafl-master\build64\Debug\templates\fuzz2222222-moe69skripnpti.html

after 1st iteration it does not close automatically

please suggest

Leaking GDI objects

Hi,
first of all, thanks for this wonderful work!
I have an issue. Recently I managed to tear down my vmware workstation fuzzing a simple executable. every run under WinAFL increased GDI objects by 2 on my host. When I've tried to execute in a batch only fuzzed executable, I haven't noticed any increase.

PROGRAM ABORT : No instrumentation detected

Hi, just took this project out for a spin, but following your instructions I get the following output from the test.exe you provide as example.

[*] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[*] Deleting old session data...
[+] Output dir cleanup successful.
[*] Scanning '..\..\testcases\others\text'...
[+] No auto-generated dictionary tokens to reuse.
[*] Creating hard links for all input files...
[*] Attempting dry run with 'id_000000'...

[-] PROGRAM ABORT : No instrumentation detected
         Location : perform_dry_run(), C:\Users\rodrigoa\Desktop\kcode\winafl\afl-fuzz.c:2526

I also get a DR_ASSERT_MSG with the error

unrecognized command received over pipe

The command value is 0x0.

The program runs just fine if I execute

%drpath%\drrun.exe -c %waflpath%\winafl.dll -debug -target_module test.exe -target_offset 0x1010 -fuzz_iterations 10 -nargs 2 -- test.exe ..\..\testcases\others\text\hello_world.txt

The command line I am using is

afl-fuzz -i ..\..\testcases\others\text -o out -D %drpath% -t 2000 -- -fuzz_iterations 10 -target_module test.exe -target_offset 0x1010 -nargs 2 -- test.exe @@

I am using 64 bit binaries for everything and DynamoRIO version 6.1.1-3

DynamoRIO doesn't work with winafl.dll

Hi, I ran the command like the following to check if DynamoRIO works with winafl:

D:\fuzz\DynamoRIO-Windows-6.2.0-2\bin32\drrun.exe -c D:\fuzz\winafl\bin32\winafl.dll -debug -target_module VUPlyaer.exe -target_offset 0x4532a0 -fuzz_iterations 10  --  VUPlayer.exe in

However, this command will terminate within 1 second and output nothing, no error, no logs. If I remove the -c winafl.dll option, the dynamo will somehow open the targeted exe file for me. It seems winafl has some problem working with dynamo.

Besides, if I use the following command, winafl seems to enter a endless loop and not taking CPU usage at all. The target program's process is also not showing up in the task manager.

D:/fuzz/winafl/bin32/afl-fuzz.exe -i in -o out -D D:/fuzz/DynamoRIO-Windows-6.2.0-2/bin32 -t 20000 --  -fuzz_iterations 5 -target_module VUPlayer.exe -target_offset 0x4532a0 -nargs 2 -- VUPlayer.exe

BTW, I'm using DynamoRIO 6.2.0-2.

I'm getting unique crashes when in fact they are exceptions

Hey all,
I could appreciate your help.
I wrote a wrapper which uses PhotoViewer.dll to load and draw images using Windows Photo Viewer and Windows Imaging Component.
Everything works great (really slow, as each image gets opened and closed using a another program which catches the Photo Viewer window and closes it, but I cant see any other solution) and I'm getting unique crashes and hangs.
Here's the commandline:
"C:\Users\john\Desktop\winafl-master\build32\Debug\afl-fuzz.exe" -m 2000 -i "C:\Users\john\Desktop\results\images" -o "C:\Users\john\Desktop\results\syncdir" -M fuzzer01 -D "C:\Users\john\Desktop\DynamoRIO-Windows-6.2.0-2\bin32" -t 20000 -- -coverage_module WindowsCodecs.dll -fuzz_iterations 100 -target_module PhotoViewerLoader.exe -target_offset 0x1040 -nargs 2 -- PhotoViewerLoader.exe @@

When examining these crashes, I get the same exception which probably leads to nowhere. I'm having trouble understanding what I'm missing.

When I open the files in the crash folder, Windows Photo Viewer does not crash but writes that the file is corrupt.
Any ideas? I welcome them all! critics as well :)

Thanks,
doria90

Build Failed

Admittedly, I'm a noob at building software on Windoze with cMake so this may be PEBCAK. When I followed the README instructions for compiling WinAFL, I got the following linker errors. I was trying to build for 32 bit arch using the VS x86 Native Tools Command Prompt. VS 14.0 on Windows 10. Am I missing something?

Thanks!

Project "C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\ALL_BUILD.vcxproj" (1) is building "C:\User
s\cynicxer\Desktop\winafl-master\winafl-master\build32\test_gdiplus.vcxproj" (5) on node 1 (default targets).
PrepareForBuild:
  Creating directory "test_gdiplus.dir\Release\".
  Creating directory "test_gdiplus.dir\Release\test_gdiplus.tlog\".
InitializeBuildStatus:
  Creating "test_gdiplus.dir\Release\test_gdiplus.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Users/cynicxer/Desktop/winafl-master/winafl-master/CMakeLists.txt
  CMake does not need to re-run because C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\CMakeFiles\g
  enerate.stamp is up-to-date.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /I"C:\Users\cynicxer\Desktop\DynamoRIO-Wind
  ows-6.2.0-2\cmake\..\include" /I"C:\Users\cynicxer\Desktop\DynamoRIO-Windows-6.2.0-2\cmake\..\ext\include" /nolo
  go /W1 /WX- /O2 /Oy- /D "CMAKE_INTDIR=\"Release\"" /D _MBCS /Gm- /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Z
  c:inline /Fo"test_gdiplus.dir\Release\\" /Fd"test_gdiplus.dir\Release\vc140.pdb" /Gd /TP /analyze- /errorReport:
  queue "C:\Users\cynicxer\Desktop\winafl-master\winafl-master\gdiplus.cpp"
  gdiplus.cpp
Link:
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\cynicxer\D
  esktop\winafl-master\winafl-master\build32\Release\test_gdiplus.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32
  .lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib gdiplus.lib /M
  ANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:"C:/Users/cynicxer/Desktop/winafl
  -master/winafl-master/build32/Release/test_gdiplus.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPL
  IB:"C:/Users/cynicxer/Desktop/winafl-master/winafl-master/build32/Release/test_gdiplus.lib" /MACHINE:X86 /SAFESE
  H  /machine:X86 test_gdiplus.dir\Release\gdiplus.obj
  test_gdiplus.vcxproj -> C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\Release\test_gdiplus.exe
FinalizeBuildStatus:
  Deleting file "test_gdiplus.dir\Release\test_gdiplus.tlog\unsuccessfulbuild".
  Touching "test_gdiplus.dir\Release\test_gdiplus.tlog\test_gdiplus.lastbuildstate".
Done Building Project "C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\test_gdiplus.vcxproj" (defaul
t targets).

Project "C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\ALL_BUILD.vcxproj" (1) is building "C:\User
s\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj" (6) on node 1 (default targets).
PrepareForBuild:
  Creating directory "winafl.dir\Release\".
  Creating directory "winafl.dir\Release\winafl.tlog\".
InitializeBuildStatus:
  Creating "winafl.dir\Release\winafl.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Users/cynicxer/Desktop/winafl-master/winafl-master/CMakeLists.txt
  CMake does not need to re-run because C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\CMakeFiles\g
  enerate.stamp is up-to-date.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /I"C:\Users\cynicxer\Desktop\DynamoRIO-Wind
  ows-6.2.0-2\cmake\..\include" /I"C:\Users\cynicxer\Desktop\DynamoRIO-Windows-6.2.0-2\cmake\..\ext\include" /Zi /
  nologo /W3 /WX- /O2 /Ob1 /Oy- /D WIN32 /D _WINDOWS /D NDEBUG /D X86_32 /D WINDOWS /D "CMAKE_INTDIR=\"Release\""
  /D winafl_EXPORTS /D _WINDLL /D _MBCS /Gm- /MT /GS- /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"winafl.d
  ir\Release\\" /Fd"winafl.dir\Release\vc140.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\cynicxer\Desktop\
  winafl-master\winafl-master\winafl.c" "C:\Users\cynicxer\Desktop\winafl-master\winafl-master\modules.c"
  winafl.c
  modules.c
  Generating Code...
Link:
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\cynicxer\D
  esktop\winafl-master\winafl-master\build32\Release\winafl.dll" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib g
  di32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib libcmt.lib "C:\Users
  \cynicxer\Desktop\DynamoRIO-Windows-6.2.0-2\ext\lib32\release\drx.lib" "C:\Users\cynicxer\Desktop\DynamoRIO-Wind
  ows-6.2.0-2\ext\lib32\release\drcontainers.lib" "C:\Users\cynicxer\Desktop\DynamoRIO-Windows-6.2.0-2\ext\lib32\r
  elease\drreg.lib" "C:\Users\cynicxer\Desktop\DynamoRIO-Windows-6.2.0-2\ext\lib32\release\drwrap.lib" "C:\Users\c
  ynicxer\Desktop\DynamoRIO-Windows-6.2.0-2\lib32\ntdll_imports.lib" "C:\Users\cynicxer\Desktop\DynamoRIO-Windows-
  6.2.0-2\ext\lib32\release\drmgr.lib" "C:\Users\cynicxer\Desktop\DynamoRIO-Windows-6.2.0-2\ext\lib32\release\drco
  ntainers.lib" "C:\Users\cynicxer\Desktop\DynamoRIO-Windows-6.2.0-2\lib32\release\dynamorio.lib" /MANIFEST /MANIF
  ESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:"C:/Users/cynicxer/Desktop/winafl-master/winafl
  -master/build32/Release/winafl.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/cynicxe
  r/Desktop/winafl-master/winafl-master/build32/Release/winafl.lib" /MACHINE:X86 /SAFESEH  /machine:X86 /nodefault
  lib /DLL winafl.dir\Release\winafl.obj
  winafl.dir\Release\modules.obj
     Creating library C:/Users/cynicxer/Desktop/winafl-master/winafl-master/build32/Release/winafl.lib and object
  C:/Users/cynicxer/Desktop/winafl-master/winafl-master/build32/Release/winafl.exp
libcmt.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __initterm referenced in function "int __c
decl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAUHINS
TANCE__@@QAX@Z) [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __initterm_e referenced in function "int _
_cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAUHI
NSTANCE__@@QAX@Z) [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol __except_handler4 [C:\Users\cynicxer\Deskt
op\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(utility.obj) : error LNK2001: unresolved external symbol __except_handler4 [C:\Users\cynicxer\Desktop\w
inafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(_sehprolg4_.obj) : error LNK2001: unresolved external symbol __except_handler4 [C:\Users\cynicxer\Deskt
op\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __seh_filter_dll referenced in function ___scr
t_dllmain_exception_filter [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __configure_narrow_argv referenced in function
 "public: static int __cdecl __scrt_narrow_argv_policy::configure_argv(void)" (?configure_argv@__scrt_narrow_argv_
policy@@SAHXZ) [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __initialize_narrow_environment referenced in
function ___scrt_dllmain_after_initialize_c [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.
vcxproj]
libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __initialize_onexit_table referenced in functi
on ___scrt_initialize_onexit_tables [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __register_onexit_function referenced in funct
ion __onexit [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __execute_onexit_table referenced in function
___scrt_dllmain_uninitialize_c [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __crt_atexit referenced in function __onexit [
C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __crt_at_quick_exit referenced in function _at
_quick_exit [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __cexit referenced in function ___scrt_dllmain
_uninitialize_c [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(tncleanup.obj) : error LNK2019: unresolved external symbol ___std_type_info_destroy_list referenced in
function "void __cdecl __scrt_uninitialize_type_info(void)" (?__scrt_uninitialize_type_info@@YAXXZ) [C:\Users\cyni
cxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
libcmt.lib(utility_desktop.obj) : error LNK2019: unresolved external symbol _terminate referenced in function ___s
crt_unhandled_exception_filter@4 [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\Release\winafl.dll : fatal error LNK1120: 14 unresol
ved externals [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
Done Building Project "C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj" (default targ
ets) -- FAILED.

Done Building Project "C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\ALL_BUILD.vcxproj" (default t
argets) -- FAILED.


Build FAILED.

"C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj" (default target) (6) ->
(Link target) ->
  libcmt.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __initterm referenced in function "int _
_cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAUHI
NSTANCE__@@QAX@Z) [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __initterm_e referenced in function "int
 __cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAU
HINSTANCE__@@QAX@Z) [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol __except_handler4 [C:\Users\cynicxer\Des
ktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(utility.obj) : error LNK2001: unresolved external symbol __except_handler4 [C:\Users\cynicxer\Desktop
\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(_sehprolg4_.obj) : error LNK2001: unresolved external symbol __except_handler4 [C:\Users\cynicxer\Des
ktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __seh_filter_dll referenced in function ___s
crt_dllmain_exception_filter [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __configure_narrow_argv referenced in functi
on "public: static int __cdecl __scrt_narrow_argv_policy::configure_argv(void)" (?configure_argv@__scrt_narrow_arg
v_policy@@SAHXZ) [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __initialize_narrow_environment referenced i
n function ___scrt_dllmain_after_initialize_c [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winaf
l.vcxproj]
  libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __initialize_onexit_table referenced in func
tion ___scrt_initialize_onexit_tables [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxpro
j]
  libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __register_onexit_function referenced in fun
ction __onexit [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __execute_onexit_table referenced in functio
n ___scrt_dllmain_uninitialize_c [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __crt_atexit referenced in function __onexit
 [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __crt_at_quick_exit referenced in function _
at_quick_exit [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(utility.obj) : error LNK2019: unresolved external symbol __cexit referenced in function ___scrt_dllma
in_uninitialize_c [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(tncleanup.obj) : error LNK2019: unresolved external symbol ___std_type_info_destroy_list referenced i
n function "void __cdecl __scrt_uninitialize_type_info(void)" (?__scrt_uninitialize_type_info@@YAXXZ) [C:\Users\cy
nicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  libcmt.lib(utility_desktop.obj) : error LNK2019: unresolved external symbol _terminate referenced in function __
_scrt_unhandled_exception_filter@4 [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]
  C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\Release\winafl.dll : fatal error LNK1120: 14 unres
olved externals [C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32\winafl.vcxproj]

    0 Warning(s)
    17 Error(s)

Time Elapsed 00:00:08.00

C:\Users\cynicxer\Desktop\winafl-master\winafl-master\build32>

Assert Failure: ..\winafl.c:422: (unreconized command recieved over pipe)

I am trying to fuzz foxit reader with winafl , i have run the foxit reader in drrun using

drrun.exe -c winafl.dll -debug -target_module "foxitreader.exe" -target_offset 0x5d22a6 -fuzz_iterations 10 -nargs 2 -- "C:/Program Files (x86)/Foxit Software/Foxit Reader/foxitreader.exe" test.pdf

I have checked the log file and everything works fine.

But when I am tryin to fuzz using the below command I am getting the error

Assert Failure: ..\winafl.c:422: (unreconized command recieved over pipe) and the afl exits.

C:\Tools\winafl\bin32>afl-fuzz.exe -i "C:\Tools\in" -o "C:\Tools\out" -D "C:\Tools\rio\bin32" -t 20000 -- -fuzz_iterations 5000 -coverage_module "foxitreader.exe" -target_module "foxitreader.exe" -target_offset 0x5d22a6 -nargs 2 -- "C:/Program Files (x86)/Foxit Software/Foxit Reader/foxitreader.exe" @@
WinAFL 1.08 by [email protected]
Based on AFL 1.96b by [email protected]
[] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[
] Deleting old session data...
[+] Output dir cleanup successful.
[] Scanning 'C:\Tools\in'...
[+] No auto-generated dictionary tokens to reuse.
[
] Creating hard links for all input files...
[*] Attempting dry run with 'id_000000'...

[-] PROGRAM ABORT : No instrumentation detected
Location : perform_dry_run(), ..\afl-fuzz.c:2641

Enabling PageHeap while fuzzing?

Hi @ivanfratric!

I'm using WinAFL to fuzz some small apps and I was wondering if I should enable PageHeap during the fuzzing campaign. I would say yes, but maybe it could lead to some bugs with DynamoRIO or it slows down the executions per second. Do you have any advice?

Thanks!

The program took more than 2000 ms to process one of the initial test cases

I am trying to fuzz with aflwin .. I have created a very simple print hello world application

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{   
        printf("argv[1]: %s\n", argv[1]);
    printf("Hello world\n");
    return 0;
}

Then I tried to fuzz using the following command

afl-fuzz.exe -i test_dll\in -o test_dll\out -D \path\to\DynamoRIO-Windows-6.1.1-3\bin64 -t 2000 -- -targert_module simple.exe targer_offset 0x1720 -fuzz_iterations 100 -- simple.exe @@
0 processes nudged
afl-fuzz 1.96b by <[email protected]>
[*] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[*] Deleting old session data...
[+] Output dir cleanup successful.
[*] Scanning 'test_dll\in'...
[+] No auto-generated dictionary tokens to reuse.
[*] Creating hard links for all input files...
[*] Attempting dry run with 'id_000000'...
Attempting to load .DLL: test_dll2...
DLL handle is: 6a1c0000
file: test_dll\out\.cur_input
arg1: test

[-] The program took more than 2000 ms to process one of the initial test cases.
    Usually, the right thing to do is to relax the -t option - or to delete it
    altogether and allow the fuzzer to auto-calibrate. That said, if you know
    what you are doing and want to simply skip the unruly test cases, append
    '+' at the end of the value passed to -t ('-t 2000+').

[-] PROGRAM ABORT : Test case 'id_000000' results in a hang
         Location : perform_dry_run(), ..\afl-fuzz.c:2451

I tried to locate what is wrong .. the only thing I can see when I try to run

C:\>path\to\DynamoRIO-Windows-6.1.1-3\bin32\drrun.exe -c winafl.dll -debug -target_module abc\simple.exe -target_offset 0x016F4 -fuzz_iterations 10 -nargs 2 -- abc\simple.exe

It doesn't run the application 10 times ... it only run the application once !!
Any ideas? ?

winafl not catching crashing testcases

So i've re-encounterd a crashing testcase and the same thing is happening; winafl does not detect the event. The 'crashes' directory is empty and the output it was mutating doesn't look like the last few paths. Also .cur_input does not cause a crash

output:

WinAFL

0 processes nudged
ERROR: The process "5997840" not found.

[-] PROGRAM ABORT : Cannot kill child process

     Location : destroy_target_process(), ..\afl-fuzz.c:2127

Windbg:

User mode DEP access violations are exploitable.

I did remember to take a minidump, but now i'll have to sift through the memory or fuzz the originating testcase again to find the crashing input.

Is there anything i might be doing wrong or is there something i can do to work around this?

Program output gets mixed with afl status view

When fuzzing a few extraction binaries i bumped into an inconvenience;

Having the program extract the input to stdout is neccesary to avoid tons of 'unique' extracted files with mangled filenames. And also because i find it soothing to watch a bunch of illegal unicode flash by XD.
But when i do this the output gets mixed with afl's.
i've tried redirecting the output to NUL and starting it in another window, unfortunately this doesn't play nice with how the command is passed to winafl.

Would it be possible to have the target binary start from a new window? Or could i do this myself and am i overlooking a command?

usage of target_method

i have a method , which is basically a constructor. whenever i provide target_method with method name it pops error saying cant find specific module in fuzz_method.
i also have the debug symbols located in same directory of binary.
please help me out in writing proper syntax for executing code

PROGRAM ABORT : All test cases time out, giving up!

I am getting the following error when I run the test cases. Kindly help to resolve it. DynamoRIO is version 6.2.0

afl-fuzz.exe -i ....\testcases\images\bmp -o ..\output -D C:\Users\Sanjeev\Documents\DynamoRIO\bin32 -t 20000+ -- -fuzz_iterations 100 -- test
_gdiplus.exe @@
WinAFL 1.09 by [email protected]
Based on AFL 2.43b by [email protected]
[] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[
] Deleting old session data...
[+] Output dir cleanup successful.
[] Scanning '....\testcases\images\bmp'...
[+] No auto-generated dictionary tokens to reuse.
[
] Creating hard links for all input files...
[*] Attempting dry run with 'id_000000'...
[!] WARNING: Test case results in a timeout (skipping)

[-] PROGRAM ABORT : All test cases time out, giving up!
Location : perform_dry_run(), ..\afl-fuzz.c:2695

process 3272 is not running under DR 0 processes nudged

README says "relative path" but should say "full path"

My particular folder structure had 3 layers of folders since I unzipped the DynamoRIO stuff into a folder outside of the project and it failed to find the DynamoRIO files. When I used the full path, it was able to compile.

WinAFL Crashes with testing code

I am getting the following crash on running the winafl.

<Application C:\Users\in3o\Documents\FuzzSample\Release\FuzzSample.exe (15208). WinAFL internal crash at PC 0x70f5cffb. Please report this at . Program aborted. 0xc0000005 0x00000000 0x70f5cffb 0x70f5cffb 0x00000003 0x00000000 Base: 0x70e90000 Registers: eax=0x00000000 ebx=0x012ff288 ecx=0xd27a70b4 edx=0x00000000 esi=0x2222e330 edi=0x2222e324 esp=0x012ff2a8 ebp=0x012ff358 eflags=0x0001020 version 6.2.17367, custom build -no_dynamic_options -client_lib 'C:\Users\in3o\Desktop\acrobat\winafl\bin32\winafl.dll;0;"-debug" "-target_module" "C:\Users\in3o\Documents\FuzzSample\Release\FuzzSample.exe" "-target_method" "Fuzz" "-coverage_module" "vulnerable.dll" "-fuzz_iterations" "10000"' -code_api -probe_api -stack_size 56K -max_elide_jmp 0 -max_ 0x012ff358 0x70f376f4 0x012ff384 0x70f37591 0x012ff890 0x70f372db 0x012ff8d0 0x70ec095d 0x012ff8f8 0x70f30f2c 0x012ff918 0x70f5c8c8>

I am running the fuzzer with following command line.

C:\Users\in3o\Desktop\acrobat\dynamorio\build\bin32\drrun.exe -c winafl.dll -debug -target_module C:\Users\in3o\Documents\FuzzSample\Release\FuzzSample.exe -target_method Fuzz -coverage_module vulnerable.dll -fuzz_iterations 10000 -- "C:\Users\in3o\Documents\FuzzSample\Release\FuzzSample.exe" in\sample.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.