> I’m trying to fuzz a complex parser. As a valid input mostly grammar based
> (an instuction ), using a dictionary isn’t really useful
Why? Would it be a different situation than, say, fuzzing SQL?
You can write a postprocessor to reject files that don't meet the
criteria (see experimental/). Although I would caution against
optimizing against what may be a non-issue; wasting some CPU cycles is
usually not a big deal.
stuct stat sb;
fstat(fs,&sb);
if(sb.st_size%8!=0) exit(EXIT_FAILURE);/mz
However, In order for file to be valid, it’s size must be dividable by 8.
> I don’t think sql have 600 opcodes, or rather keywords.
I don't think that what you're describing is inherently incompatible
with how AFL uses dictionaries. I'd give it a try. Its ability to put
together grammar from dictionary tokens surprises me more often than
not.
There's a discussion of how to pull this off in experimental/post_library/.
Yep, see above :-) This avoids calling the target binary altogether.
/mz
Why dont you read in the input file, truncate it to be an even multiple of 8-bytes, and pass it to the parser?Tim
Truncate, not pad - you make it smaller until it is a multiple of 8. The extra
bytes are thrown away. If the file is smaller than 8 bytes, exit with an error.
On Thursday 03 November 2016 06:43:57 lael.c...@gmail.com wrote:
> Le jeudi 3 novembre 2016 13:32:46 UTC+1, Chris Kerr a écrit :
> > Truncate, not pad - you make it smaller until it is a multiple of 8. The
> > extra
> > bytes are thrown away. If the file is smaller than 8 bytes, exit with an
> > error.
They are useful. AFL learns that files shorter than 8 bytes aren't interesting
and will subsequently concentrate more fuzzing effort on files longer than 8
bytes.
On 2016-11-03 12:32, lael.c...@gmail.com wrote:
why?
You mean the test cases in <out_dir>/queue/?
If these cases crash, they should not be appearing in the output dir at all.
/mz
> And in those 5 hours, no crash were found.
In an earlier e-mail, you said: "However, In order for file to be
valid, it’s size must be dividable by 8. Trying to parse a file that
don’t have that follow this rule always segfault the parser."
So I'm not sure how to reconcile this?
stuct stat sb;
fstat(fd,&sb);
if(sb.st_size%BUNDLE_SIZE) exit(EXIT_FAILURE);/mz
> I also said that I do something like this in the target process :
> stuct stat sb;
> fstat(fd,&sb);
> if(sb.st_size%BUNDLE_SIZE) exit(EXIT_FAILURE);
In this case, the queue should be mostly files that meet your
criteria; I suggest looking at that as an indicator of what AFL is
spending its time on.
> By the way, you still didn’t explained how I can get afl to load the compile
> post processing library ?
I did, several e-mails ago; please see experimental/post_library/.
Specifically, see the header of post_library.so.c.
so, looking at experimental/post_library/post_library.so.c, I see
> the postprocessor library is passed to afl-fuzz via AFL_POST_LIBRARY.
Can you please have a look at the queue and tell us what percentage of
test cases meet your criteria, and how many of them do you have total?
In general, if AFL is not finding too many code paths in the program,
the more likely explanation is that it is bumping into a roadblock
unrelated to a relatively trivial size constraint. 14 paths strongly
suggests that it isn't. Perhaps it needs a dictionary, perhaps the
program quits prematurely for other reasons (memory limits, incorrect
cmdline), perhaps not all files are properly instrumented -
unfortunately, this can be a bit painful to troubleshoot.
[lcamtuf@raccoon afl]$ grep -B 1 AFL_POST_LIBRARY
experimental/post_library/post_library.so.c
With that out of the way: the postprocessor library is passed to afl-fuzz
via AFL_POST_LIBRARY. The library must be compiled with:
Sorry, not sure I follow?
I'm guessing you're running out of memory on the system, as a
consequence of trying to run multiple instances of a target binary
that seems very memory-intensive. Checking dmesg should confirm this.
If it's not memory-intensive, then increasing memory limit from 600 MB
should not make a difference, but you're saying that it did.
That shouldn't matter, unless your system is having some serious issues.
/mz