Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

provide option for deterministic dictionary mutation in non-deterministic mode (-d or -S) #91

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

laurentsimon
Copy link

This adds support or running AFL in non-deterministic mode and a dictionary.

@@ -5117,7 +5118,7 @@ static u8 fuzz_one(char** argv) {
this entry ourselves (was_fuzzed), or if it has gone through deterministic
testing in earlier, resumed runs (passed_det). */

if (skip_deterministic || queue_cur->was_fuzzed || queue_cur->passed_det)
if ((skip_deterministic && !use_dictionary) || queue_cur->was_fuzzed || queue_cur->passed_det)
goto havoc_stage;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be simpler to leave this condition, and goto dict_stage here, and at

dict_stage:
  if (!use_dictionary) goto havoc_stage;

?

@laurentsimon
Copy link
Author

laurentsimon commented Apr 29, 2020 via email

@laurentsimon
Copy link
Author

laurentsimon commented Apr 29, 2020 via email

@vanhauser-thc
Copy link
Contributor

what is the reasoning behind the idea that a slave should also do deterministic fuzzing?

IMHO that is very bad.

deterministic fuzzing means that the generated mutations are always the same. hence they are only done once per queue entry and then never again.

with this options every slave would do the deterministic fuzzing too resulting in as many duplicates of the same fuzzing inputs as there are slaves.

if the reasoning behind is that deterministic fuzzing is running behind with many discovered queue entries as only the master is doing it, I would rather propose a different solution - only the afl-fuzz which discovers a new queue entry performs deterministic fuzzing, learned queue entries (so from other afl-fuzz instances) will not. But this means that this command line option must be given to every single instance though.

also the results at fuzzbench have shown that deterministic fuzzing discovers less paths than random fuzzing, especially with a good and large corpus.

@laurentsimon
Copy link
Author

laurentsimon commented Apr 29, 2020 via email

@laurentsimon laurentsimon changed the title add support for -x -d/-S together add dictionary support in non-deterministic mode (-d or -S) Apr 29, 2020
@vanhauser-thc
Copy link
Contributor

@laurentsimon ah sorry, the original title was misleading so I thought it would activate deterministic fuzzing in slaves :)

Now I get your point - you want to have dictionaries if -x is used, which are silently ignored if -S or -d otherwise.

You still have the issue that the dictionary part is done every time the queue entry is selected and not only once and that is an issue that should be fixed (setting and checking passed_det).

And I think you should show a warning though. either warn it is ignored (if left as is), or warn that if other instances are running that there will be duplicates.

@vanhauser-thc
Copy link
Contributor

vanhauser-thc commented Apr 30, 2020

Oh and I totally forgot:

dictionaries are not ignored with -S/-d. in havoc:

    switch (rand_below(
          afl, 15 + ((extras_cnt + a_extras_cnt) ? 2 : 0))) {

so if there are dictionaries, stages 15 + 16 are activated and they randomly put dictionary entries in the mutation

@laurentsimon
Copy link
Author

laurentsimon commented Apr 30, 2020 via email

@laurentsimon laurentsimon changed the title add dictionary support in non-deterministic mode (-d or -S) force deterministic dictionary usage in non-deterministic mode (-d or -S) Apr 30, 2020
@laurentsimon laurentsimon changed the title force deterministic dictionary usage in non-deterministic mode (-d or -S) provide option for deterministic dictionary mutation in non-deterministic mode (-d or -S) Apr 30, 2020
@vanhauser-thc
Copy link
Contributor

well you could put an entry to fuzzbench with this patch and then we can see if it makes it perform better or not overall. "overall" is however just an indicator. if something is really good at corner cases it could already be good to have.

@laurentsimon
Copy link
Author

laurentsimon commented Apr 30, 2020 via email

Copy link
Contributor

@Dor1s Dor1s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lszekeres @laurentsimon what's the final decision here? Do we merge this or close?

@laurentsimon
Copy link
Author

laurentsimon commented Aug 4, 2020 via email

@lszekeres
Copy link
Member

it's not been tested so we cannot merge it. Maybe we could create a branch for it so we could test it on fuzzbench...?

This says 4, but grepping dict on fuzzbench/benchmark says 9 :)

Consider running a fuzzbench experiment using the branch of this PR (ie https://github.com/laurentsimon/AFL) and compare to upstream afl.

@laurentsimon
Copy link
Author

@jonathanmetzman shall we run an experiment with the modified AFL, as suggested by @lszekeres ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants