fuzzingafl-fuzz

How to make afl-fuzz not skip test cases when a timeout is reached


I am currently trying to fuzz a PDF viewer with the AFL fuzzer (American Fuzzy Lop).

My problem is quite simple, afl-fuzz expect the application to take an input and close after processing it. But, the PDF viewer is intended to open the document and stay open until closed. The result is that afl-fuzz reach the timeout for all initial inputs and decide to stop here.

...
[*] Validating target binary...
[*] Attempting dry run with 'id:000000,orig:myPDFsample00.pdf'...
[*] Spinning up the fork server...
[+] All right - fork server is up.
[!] WARNING: Test case results in a timeout (skipping)
[*] Attempting dry run with 'id:000001,orig:myPDFsample01.pdf'...
[!] WARNING: Test case results in a timeout (skipping)
[*] Attempting dry run with 'id:000002,orig:myPDFsample02.pdf'...

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

I would like to know how to tell AFL to consider that reaching the timeout and get the program terminated is a "normal" behavior for the test case.


Solution

  • In fact, the usual way to do seems to simply instrument the code of the software you are looking at by adding an exit(0) after the parsing.

    It seems quite basic, but I works...

    The other way could be to change the meaning of a timeout in the AFL software. But, then, it won't detect 'hangs' when your software might enter a never ending loop.

    So, the best way really seems to add an exit(0) (or return 0 if you are in main()) inside your target software just after the parsing is done.