Expanding the Reach of Fuzzing Caroline Lemieux September 8 th , - - PowerPoint PPT Presentation

expanding the reach of fuzzing
SMART_READER_LITE
LIVE PREVIEW

Expanding the Reach of Fuzzing Caroline Lemieux September 8 th , - - PowerPoint PPT Presentation

Expanding the Reach of Fuzzing Caroline Lemieux September 8 th , 2020 Fuzzcon Europe Coverage-Guided Fuzzing Greybox, Mutational seeds Input Input Input Input Initial Input pick mutate Input execute Input Input Input n save


slide-1
SLIDE 1

Expanding the Reach of Fuzzing

Caroline Lemieux September 8th, 2020 Fuzzcon Europe

slide-2
SLIDE 2 1 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

Coverage-Guided Fuzzing

Execution Feedback Execution Feedback Execution Feedback Execution Feedbackn Input2’ Inputn’ Interesting Feedback? pick Initial Input Input Input Input seeds save

Greybox, Mutational

slide-3
SLIDE 3 2 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

Coverage-Guided Fuzzing

Execution Feedback Execution Feedback Execution Feedback Execution Feedbackn Input2’ Inputn’ Interesting Feedback? pick Initial Input Input Input Input seeds save

Greybox, Mutational

Can we modify CGF tools for:

Different Bugs Deeper Exploration

slide-4
SLIDE 4 9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 3

Different Bugs Deeper Exploration

slide-5
SLIDE 5 9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 4

Deeper Exploration

Pe PerfFuzz

https://github.com/carolemieux/perffuzz

Fu FuzzF zzFactor

  • ry

https://github.com/rohanpadhye/FuzzFactory

slide-6
SLIDE 6 5 9/10/20

Nobody Expects Performance Problems

Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-7
SLIDE 7

Pathological Input Profiling Tool

DE DEV

6

Alleviating Performance Problems

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-8
SLIDE 8

Pathological Input Profiling Tool

DE DEV

7

Alleviating Performance Problems

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-9
SLIDE 9

Pathological Input Profiling Tool

DE DEV

Automatically generate pathological inputs

8

PerfFuzz Goal

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-10
SLIDE 10 9 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

Can We Use Coverage-Guided Fuzzing?

Execution Feedback Execution Feedback Execution Feedback Execution Feedbackn Input2’ Inputn’ Interesting Feedback? pick Initial Input Input Input Input seeds save Execution time of input Input executes for longer?

slide-11
SLIDE 11 10 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

Can We Use Coverage-Guided Fuzzing?

Execution Feedback Execution Feedback Execution Feedback Execution Feedbackn Input2’ Inputn’ Interesting Feedback? pick Initial Input Input Input Input seeds save Execution time of input Input executes for longer?

Too coarsed-grained!

slide-12
SLIDE 12 11 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

Can We Use Coverage-Guided Fuzzing?

Execution Feedback Execution Feedback Execution Feedback Execution Feedbackn Input2’ Inputn’ Interesting Feedback? pick Initial Input Input Input Input seeds save

slide-13
SLIDE 13 12 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

PerfFuzz

Input2’ Inputn’ Interesting Feedback? pick Initial Input Input Input Input seeds save

Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits

... ... ... ... ... ... ... ...
slide-14
SLIDE 14

Maximizes # hits for some edge?

13 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

PerfFuzz

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits

... ... ... ... ... ... ... ...

pick

slide-15
SLIDE 15

pick input maximizing # hits for some edge Maximizes # hits for some edge?

14 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

PerfFuzz

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits

... ... ... ... ... ... ... ...
slide-16
SLIDE 16
  • Maximum path length for varying input sizes
10 20 30 40 50 60 0ax InSut Length (bytes) 100 200 300 400 500 0axLPuP 3ath Length 3erI)uzz 6low)uzz 10 20 30 40 50 60 0ax InSut Length (bytes) 1000 2000 3000 0axLPuP 3ath Length 3erI)uzz 6low)uzz 10 20 30 40 50 60 0ax InSut Length (bytes) 100k 200k 300k 0axLPuP 3ath Length 3erI)uzz 6low)uzz

Insertion Sort PCRE URL regex Word Frequency

15

PerfFuzz: Algorithmic Complexity

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-17
SLIDE 17
  • Maximum path length for varying input sizes
10 20 30 40 50 60 0ax InSut Length (bytes) 100 200 300 400 500 0axLPuP 3ath Length 3erI)uzz 6low)uzz 10 20 30 40 50 60 0ax InSut Length (bytes) 1000 2000 3000 0axLPuP 3ath Length 3erI)uzz 6low)uzz 10 20 30 40 50 60 0ax InSut Length (bytes) 100k 200k 300k 0axLPuP 3ath Length 3erI)uzz 6low)uzz

Insertion Sort PCRE URL regex Word Frequency

16

PerfFuzz: Algorithmic Complexity

9/10/20

?

Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Many short words All hash collisions

slide-18
SLIDE 18

pick input maximizing # hits for some edge Maximizes # hits for some edge?

17 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

PerfFuzz

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits

... ... ... ... ... ... ... ...

https://github.com/carolemieux/perffuzz

  • Built on top of AFL
  • Comes with afl-showmax tool to

identify bad inputs

  • Requires building with afl-clang-

fast

slide-19
SLIDE 19

pick input maximizing # hits for some edge Maximizes # hits for some edge?

18 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

PerfFuzz

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits

... ... ... ... ... ... ... ...
slide-20
SLIDE 20

pick input maximizing # hits for some edge Maximizes # hits for some edge?

19 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

Observation: Algorithm is More General

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits Ed Edge # # Hits

... ... ... ... ... ... ... ...
slide-21
SLIDE 21

pick input maximizing va value for some ke key

20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

Observation: Algorithm is More General

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ke Key Va Value Ke Key Va Value Ke Key Va Value Ke Key Va Value

... ... ... ... ... ... ... ...

Maximizes va value for some ke key?

slide-22
SLIDE 22 21 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 9/10/20

What Other Problems Can We Solve?

Ke Key Va Value

... ... ... ... ... ... ... ...

slide-23
SLIDE 23 22 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 9/10/20

What Other Problems Can We Solve?

Ke Key Va Value

... ... ... ... ... ... ... ...

Memory Allocation Location: x = malloc(…); Line 247: Cumulative amount of memory allocated

e.g. finding memory-allocation maximizing inputs

slide-24
SLIDE 24 23 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 9/10/20

What Other Problems Can We Solve?

Ke Key Va Value

... ... ... ... ... ... ... ...

“Hard” Comparison Location: if ( x == 0xBAD0CAFE) Number of bits matched

e.g. going through “hard” comparisons

slide-25
SLIDE 25

pick input maximizing va value for some ke key

24 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

Observation: Algorithm is More General

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ke Key Va Value Ke Key Va Value Ke Key Va Value Ke Key Va Value

... ... ... ... ... ... ... ...

Maximizes va value for some ke key?

slide-26
SLIDE 26

pick input maximizing va value for some ke key

25 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

FuzzFactory

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ke Key Va Value Ke Key Va Value Ke Key Va Value Ke Key Va Value

... ... ... ... ... ... ... ...

Maximizes va value for some ke key?

slide-27
SLIDE 27

pick input with newest aggregate va value for some ke key

26 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

FuzzFactory, Step 1: Generalize Algorithm

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ke Key Va Value Ke Key Va Value Ke Key Va Value Ke Key Va Value

... ... ... ... ... ... ... ...

New aggregate va value for some ke key

slide-28
SLIDE 28

pick input with newest aggregate va value for some ke key

27 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

FuzzFactory, Step 2: Separate Algo & Feedback

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ke Key Va Value Ke Key Va Value Ke Key Va Value Ke Key Va Value

... ... ... ... ... ... ... ...

New aggregate va value for some ke key

slide-29
SLIDE 29

pick input with newest aggregate va value for some ke key

28 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

FuzzFactory, Step 2: Separate Algo & Feedback

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ke Key Va Value Ke Key Va Value Ke Key Va Value Ke Key Va Value

... ... ... ... ... ... ... ...

New aggregate va value for some ke key Domain-specific instrumentation

slide-30
SLIDE 30

pick input with newest aggregate va value for some ke key

29 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

FuzzFactory, Step 2: Separate Algo & Feedback

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ke Key Va Value Ke Key Va Value Ke Key Va Value Ke Key Va Value

... ... ... ... ... ... ... ...

New aggregate va value for some ke key Domain-specific instrumentation /* * Creates a new DSF map `name` with `size` keys, * `reducer` function, and `initial` aggregate value. * * To be called at the top-level global scope. */ FUZZFACTORY_DSF_NEW(name, size, reducer, initial) /* Set dsf[k] = max(dsf[k], v); */ FUZZFACTORY_DSF_MAX(dsf, k, v) /* Set dsf[k] = dsf[k] | v; */ FUZZFACTORY_DSF_BIT(dsf, k, v) /* Set dsf[k] = v; */ FUZZFACTORY_DSF_SET(dsf, k, v) /* Set dsf[k] = dsf[k] + v; */ FUZZFACTORY_DSF_INC(dsf, k, v)

slide-31
SLIDE 31

Six LLVM-based Domains in FuzzFactory

Fuzzer Keys Values Aggregation LoC (C++) Port of SlowFuzz [Petsios et al. ‘17] Port of PerfFuzz [Lemieux et al. ‘18] Validity Fuzzing [Padhye et al. ’19] Mem Alloc Fuzzing Cmp Fuzzing Incremental Fuzzing

30 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 9/10/20
slide-32
SLIDE 32

Six LLVM-based Domains in FuzzFactory

Fuzzer Keys Values Aggregation LoC (C++) Port of SlowFuzz [Petsios et al. ‘17] Singleton Path length max Port of PerfFuzz [Lemieux et al. ‘18] Basic Blocks Exec Counts max Validity Fuzzing [Padhye et al. ’19] Basic Blocks Exec Counts if Valid else 0 log-union (AFL-style bucketing) Mem Alloc Fuzzing Locations invoking malloc()/calloc() # of bytes allocated max Cmp Fuzzing ==, strcmp, memcmp, switch, etc. # of bits common between operands max Incremental Fuzzing Basic Block Transitions Exec Counts log-union (AFL-style bucketing)

31 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 9/10/20
slide-33
SLIDE 33

Six LLVM-based Domains in FuzzFactory

Fuzzer Keys Values Aggregation LoC (C++) Port of SlowFuzz [Petsios et al. ‘17] Singleton Path length max 18 Port of PerfFuzz [Lemieux et al. ‘18] Basic Blocks Exec Counts max 19 Validity Fuzzing [Padhye et al. ’19] Basic Blocks Exec Counts if Valid else 0 log-union (AFL-style bucketing) 24 Mem Alloc Fuzzing Locations invoking malloc()/calloc() # of bytes allocated max 29 Cmp Fuzzing ==, strcmp, memcmp, switch, etc. # of bits common between operands max 355 Incremental Fuzzing Basic Block Transitions Exec Counts log-union (AFL-style bucketing) 146

32 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 9/10/20
slide-34
SLIDE 34

pick input with newest aggregate va value for some ke key

33 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

FuzzFactory, Step 2: Separate Algo & Feedback

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ke Key Va Value Ke Key Va Value Ke Key Va Value Ke Key Va Value

... ... ... ... ... ... ... ...

New aggregate va value for some ke key Domain-specific instrumentation

slide-35
SLIDE 35

Key Value Key Value Key Value Key Value

... ... ... ... ... ... ... ...

Domain-specific instrumentation pick input with newest aggregate va value for some ke key

34 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

FuzzFactory, Step 2: Allows Easy Composition

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ke Key Va Value Ke Key Va Value Ke Key Va Value Ke Key Va Value

... ... ... ... ... ... ... ...

New aggregate va value for some ke key Domain-specific instrumentation

slide-36
SLIDE 36

Super-Fuzzer: CMP ∘ MEM

35 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 9/10/20
slide-37
SLIDE 37

Super-Fuzzer: CMP ∘ MEM

36

LZ4 Bomb (4GB alloc when decoding 21-byte input) PNG Bomb (2GB alloc when reading ~100 byte 20px image)

Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 9/10/20
slide-38
SLIDE 38

Key Value Key Value Key Value Key Value

... ... ... ... ... ... ... ...

Domain-specific instrumentation pick input with newest aggregate va value for some ke key

37 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

FuzzFactory

Input2’ Inputn’ Initial Input Input Input Input seeds save

Ke Key Va Value Ke Key Va Value Ke Key Va Value Ke Key Va Value

... ... ... ... ... ... ... ...

New aggregate va value for some ke key Domain-specific instrumentation

https://github.com/rohanpadhye/FuzzFactory

  • Built on top of AFL
  • Comes with afl-showdsf tool
  • Use our domain-specific fuzzers or build your own
slide-39
SLIDE 39 9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 38

Deeper Exploration

Pe PerfFuzz

https://github.com/carolemieux/perffuzz

Fu FuzzF zzFactor

  • ry

https://github.com/rohanpadhye/FuzzFactory

slide-40
SLIDE 40 9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 39

Different Bugs Deeper Exploration

slide-41
SLIDE 41 9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 40

Different Bugs Deeper Exploration

slide-42
SLIDE 42 9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 41

Different Bugs

Fa FairFuzz

https://github.com/carolemieux/afl-rb

JQF JQF/Zest st

https://github.com/rohanpadhye/jqf

slide-43
SLIDE 43

Where Are the Fuzzer-Found Bugs?

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 42

Input Validation Core Logic

slide-44
SLIDE 44

Where Are the Fuzzer-Found Bugs?

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 43

Input Validation Core Logic

slide-45
SLIDE 45 44 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

Coverage-Guided Fuzzing

Execution Feedback Execution Feedback Execution Feedback Execution Feedbackn Input2’ Inputn’ Interesting Feedback? pick Initial Input Input Input Input seeds save

slide-46
SLIDE 46

Branches Guard Core Logic

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 45

Input

Input Validation Core Logic

slide-47
SLIDE 47

Branches Guard Core Logic

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 46

Input Validation Core Logic

... if (tags_match(fuzz_input)): ...

Input

slide-48
SLIDE 48

Branches Guard Core Logic

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 47

<foo>ez</foo>

Input Validation Core Logic

... if (tags_match(fuzz_input)): ...

slide-49
SLIDE 49

Some branches hard-to-hit with mutants

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 48

... if (tags_match(fuzz_input)): ...

Input Validation Core Logic

mutate

<floo>ez</foo>

<foo>ez</foo>

slide-50
SLIDE 50

Some branches hard-to-hit with mutants

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 49

... if (tags_match(fuzz_input)): ...

Input Validation Core Logic

mutate

<foo>ezzzfoo>

<foo>ez</foo>

slide-51
SLIDE 51

Some branches hard-to-hit with mutants

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 50

... if (tags_match(fuzz_input)): ...

Input Validation Core Logic

mutate

<f><oo>ez</f>

<foo>ez</foo>

slide-52
SLIDE 52

Some branches hard-to-hit with mutants

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 51

... if (tags_match(fuzz_input)): ...

Input Validation Core Logic

mutate

<f><oo>ez</f>

<foo>ez</foo>

Id Idea: Can we restrict the space of mutations to hit more hard-to-hit branches?

slide-53
SLIDE 53

FairFuzz: Branch Mask Idea

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 52

... if (tags_match(fuzz_input)): ...

slide-54
SLIDE 54

FairFuzz: Branch Mask Idea

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 53

... if (tags_match(fuzz_input)): ...

True branch is rare

slide-55
SLIDE 55

FairFuzz: Branch Mask Idea

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 54

<foo>ez</foo>

... if (tags_match(fuzz_input)): ...

True branch is rare

slide-56
SLIDE 56

FairFuzz: Branch Mask Idea

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 55

<foo>ez</foo>

... if (tags_match(fuzz_input)): ...

True branch is rare hits rare branch

slide-57
SLIDE 57

FairFuzz: Branch Mask Idea

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 56

<foo>ez</foo>

... if (tags_match(fuzz_input)): ...

Where can we mutate and still hit rare branch?

slide-58
SLIDE 58

FairFuzz: Branch Mask Idea

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 57

<foo>ez</foo>

... if (tags_match(fuzz_input)): ...

Where can we mutate and still hit rare branch?

slide-59
SLIDE 59

FairFuzz: Branch Mask Idea

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 58

<foo>ez</foo>

... if (tags_match(fuzz_input)): ...

<foo>eaz</foo>

mutate with br branch mask

<foo>e</foo> <foo><e></foo>

slide-60
SLIDE 60 59 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

FairFuzz

Execution Feedback Execution Feedback Execution Feedback Execution Feedbackn Input2’ Inputn’ Interesting Feedback? pick Initial Input Input Input Input seeds save

slide-61
SLIDE 61 60 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input mutate execute

9/10/20

Input Input Input Inputn’

FairFuzz

Execution Feedback Execution Feedback Execution Feedback Execution Feedbackn Input2’ Inputn’ Interesting Feedback? pick input hitting ra rare branch Initial Input Input Input Input seeds save

slide-62
SLIDE 62

mutate with Br Branch M nch Mask

61 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input execute

9/10/20

Input Input Input Inputn’

FairFuzz

Execution Feedback Execution Feedback Execution Feedback Execution Feedbackn Input2’ Inputn’ Interesting Feedback? pick input hitting ra rare branch Initial Input Input Input Input seeds save

slide-63
SLIDE 63

FairFuzz Eval: Branch Coverage

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 62
slide-64
SLIDE 64

Where Does FairFuzz Perform Much Better?

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 63

Both are programs with nested conditional structure

  • tcpdump: if this packet type, then if

has this field…

  • xmllint: byte-by-byte comparisons
slide-65
SLIDE 65

mutate with br branch mask

64 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

Input execute

9/10/20

Input Input Input Inputn’

FairFuzz

Execution Feedback Execution Feedback Execution Feedback Execution Feedbackn Input2’ Inputn’ Interesting Feedback? pick input hitting ra rare branch Initial Input Input Input Input seeds save

https://github.com/carolemieux/afl-rb

  • Built on top of AFL
  • Works with any AFL instrumentation
  • Especially powerful in ensemble fuzzing
slide-66
SLIDE 66

Generator-Based Fuzzing

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 65

Input Generator Input

slide-67
SLIDE 67

Generator-Based Fuzzing

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 66

<a></a> Input Generator

slide-68
SLIDE 68

Generator-Based Fuzzing

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 67

<go>!!</go>

Input Generator

slide-69
SLIDE 69

Generator-Based Fuzzing

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 68

<a><b/></a>

Input Generator

slide-70
SLIDE 70

Generator-Based Fuzzing

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 69

<bb>z</bb>

Input Generator

slide-71
SLIDE 71

Generator-Based Fuzzing: Get “Deeper”

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 70

Generator

Input Validation Core Logic

Input

slide-72
SLIDE 72

Generator-Based Fuzzing: Drawbacks

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 71

Generator Execution Feedback

Input Validation Core Logic

Input passed all validation steps! Input covered new core logic!

Input

slide-73
SLIDE 73

Generator-Based Fuzzing: Drawbacks

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 72

Generator Execution Feedback

Input Validation Core Logic

??? Input

slide-74
SLIDE 74 9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 73

Parametric Generators: Explicitly Pass in Stream of Bit “Parameters”

Generator

Input

slide-75
SLIDE 75 9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 74

Parametric Generators: Explicitly Pass in Stream of Bit “Parameters”

Generator

Params

Input

slide-76
SLIDE 76 75

JQF: Framework for Guided Generator-Based Fuzzing

Generator

… 0110 0000 0101 0101 …

Input

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-77
SLIDE 77 76

JQF: Framework for Guided Generator-Based Fuzzing

Generator

… 0110 0000 0101 0101 …

Guidance

Feedback (branch coverage, input validity)

Semantic Fuzzing (Zest) CGF with AFL Complexity Fuzzing (PerfFuzz)

Fast Validity Fuzzing (RLCheck)

Input

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-78
SLIDE 78 77

JQF: Input Stream Fuzzing with AFL

Generator

… 0110 0000 0101 0101 …

Guidance

Feedback (branch coverage, input validity)

Semantic Fuzzing (Zest) CGF with AFL Complexity Fuzzing (PerfFuzz) …

Input

@Fuzz /* JQF will generate inputs to this method */ public void testRead(InputStream input) { // Create parser ImageReader reader = ImageIO.getImageReadersByFormatName("png").next(); // Decode image from input stream try { reader.setInput(ImageIO.createImageInputStream(input)); // Bound dimensions to avoid OOM Assume.assumeTrue(reader.getHeight(0) <= 256); Assume.assumeTrue(reader.getWidth(0) <= 256); // Decode first image in the input stream reader.read(0); } catch (IOException e) { // This exception signals invalid input and not a test failure Assume.assumeNoException(e); } }

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-79
SLIDE 79 78

JQF: Generator-Based Validity Fuzzing with Zest

Generator

… 0110 0000 0101 0101 …

Guidance

Feedback (branch coverage, input validity)

Semantic Fuzzing (Zest) CGF with AFL Complexity Fuzzing (PerfFuzz)

Fast Validity Fuzzing (RLCheck)

Input

@Fuzz public void testMap2Trie(Map<String, Integer> map, String key) { Assume.assumeTrue(map.containsKey(key)); Trie trie = new PatriciaTrie(map); Assert.assertTrue(trie.containsKey(key)); }

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-80
SLIDE 80 79

JQF: Framework for Guided Generator-Based Fuzzing

Generator

… 0110 0000 0101 0101 …

Guidance

Feedback (branch coverage, input validity)

Semantic Fuzzing (Zest) CGF with AFL Complexity Fuzzing (PerfFuzz)

Fast Validity Fuzzing (RLCheck)

Input

https://github.com/rohanpadhye/jqf

  • Robust Java Fuzzer w/ JUnit interface
  • Can fuzz functions that take in objects!
  • Our best trophy case
9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-81
SLIDE 81 80

JQF: Framework for Guided Generator-Based Fuzzing

Generator

… 0110 0000 0101 0101 …

Guidance

Feedback (branch coverage, input validity)

Semantic Fuzzing (Zest) CGF with AFL Complexity Fuzzing (PerfFuzz)

Fast Validity Fuzzing (RLCheck)

Input

https://github.com/rohanpadhye/jqf

  • Robust Java Fuzzer w/ JUnit interface
  • Can fuzz functions that take in objects!
  • Our best trophy case
9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

🏇 Bug Trophy Case (Sep 2020) 🏇 Google Closure Compiler: #2842, #2843, #3220, #3173 OpenJDK: JDK-8190332, JDK-8190511, JDK-8190512, JDK-8190997, JDK-8191023, JDK-8191076, JDK-8191109, JDK-8191174, JDK- 8191073, JDK-8193444, JDK-8193877 Apache Ant: #62655 Apache Maven: MNG-6374, MNG-6375, MNG-6577 Apache Commons: LANG-1385, COMPRESS-424, COLLECTIONS-714, CVE- 2018-11771 Apache PDFBox: PDFBOX-4333, PDFBOX-4338, PDFBOX-4339, CVE-2018- 8036 Apache TIKA: CVE-2018-8017, CVE-2018-12418 Apache BCEL: BCEL-303, BCEL-307, BCEL-308, BCEL-309, BCEL-310, BCEL- 311, BCEL-312, BCEL-313 Mozilla Rhino: #405, #406, #407, #409, #410

slide-82
SLIDE 82 9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 81

Pe PerfFuzz

https://github.com/carolemieux/perffuzz

Fu FuzzF zzFactor

  • ry

https://github.com/rohanpadhye/FuzzFactory

Fa FairFuzz

https://github.com/carolemieux/afl-rb

JQF JQF/Zest st

https://github.com/rohanpadhye/jqf

Thanks for listening!

slide-83
SLIDE 83 82

RLCheck: Fast Validity Fuzzing

Generator

… 0110 0000 0101 0101 …

Guidance

Feedback (branch coverage, input validity)

Semantic Fuzzing (Zest) CGF with AFL Complexity Fuzzing (PerfFuzz)

Fast Validity Fuzzing (RLCheck)

Input

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-84
SLIDE 84 83

RLCheck: Fast Validity Fuzzing

Generator

Direct Choice Control Feedback (input uniqueness, input validity)

Fast Validity Fuzzing (RLCheck)

Input

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe
slide-85
SLIDE 85

RLCheck: Make Best Choices Given Context

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 84

def genBinaryTree(depth = 0): value = random.choice([0, 1, …, 10] ) node = BinaryTree(value); if (depth < MAX_DEPTH) and random.bool( ): node.left = genBinaryTree(depth + 1) if (depth < MAX_DEPTH) and random.bool( ): node.right = genBinaryTree(depth + 1) return node

slide-86
SLIDE 86

RLCheck: Make Best Choices Given Context

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 85

def genBinaryTree(depth = 0): value = guide.choice([0, 1, …, 10], context) node = BinaryTree(value); if (depth < MAX_DEPTH) and guide.bool(context): node.left = genBinaryTree(depth + 1) if (depth < MAX_DEPTH) and guide.bool(context): node.right = genBinaryTree(depth + 1) return node

slide-87
SLIDE 87

RLCheck Idea: RL Agent at Each Choice Point

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 86

def genBinaryTree(depth = 0): value = guide.choice([0, 1, …, 10], context) node = BinaryTree(value); if (depth < MAX_DEPTH) and guide.bool(context): node.left = genBinaryTree(depth + 1) if (depth < MAX_DEPTH) and guide.bool(context): node.right = genBinaryTree(depth + 1) return node

slide-88
SLIDE 88

RLCheck: Many More Unique Valid Inputs

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe 87
slide-89
SLIDE 89 88

RLCheck: Fast Validity Fuzzing

Generator

Direct Choice Control Feedback (input uniqueness, input validity)

Fast Validity Fuzzing (RLCheck)

Input

9/10/20 Caroline Lemieux -- Expanding the Reach of Fuzzing @ FuzzCon Europe

https://github.com/sameerreddy13/rlcheck

  • Research prototype
  • Promising direction for “smarter”

blackbox fuzzing

RLCheck