Introduction to Fuzzing
Hieu Nguyen
What is fuzzing?
What can be random?
- parameters
- time
- database state
- machine state
- crash
- ...
What can be random?
- parameters
- time
- database state
- machine state
- crash
- ...
Fuzzing type
- Generational
- Mutational
Random Generational Fuzzing
- Completely random
- Generate from scratch
Random Generational Fuzzing
- Good for detecting parser error
- Hard to get meaningful input
Random Generational Fuzzing
- Good for detecting parser error
- Hard to get meaningful input
- Notable application: detect invalid memory access in
C/C++ program (heartbleed)
Mutational Fuzzing
- Generate input by adding random mutation to seed
- Mutation type:
- Add bytes
- Delete bytes
- Flip bytes
- ...
Mutational fuzzing
- Can generate more interesting input
- But...
Coverage-based Mutational Fuzzing
- Also called Greybox Fuzzing
- Use coverage to find and leverage interesting input
AFL (American Fuzzy Lop)
AFL (American Fuzzy Lop)
Compare different fuzzing strategies
Coverage-based Mutational Fuzzing
- Very effective
- Need a bit of tuning depending on application
Grammar Generational Fuzzing
- Generate random input based on grammar
- Usually use BNF (Backus–Naur form)
Grammar Generational Fuzzing
- Create more structured input
- Hard to simulate invalid input
Greybox Grammar Fuzzing
- Generate seed based on Grammar
- Mutate input
- Leverage interesting input based on coverage
Greybox Grammar Fuzzing
- Generate seed based on Grammar
- Mutate input
- Leverage interesting input based on coverage
LangFuzz
- Grammar Greybox Fuzzer
- Use for testing browser JS interpreters
- Found more than 2000 bugs!
Compare different fuzzing strategies
That’s not all...
- Add power to seed to leverage stronger seed
- Extend Grammar with EBNF and probability
- Mining seed from external source
- Use structured mutation
- Semantical fuzzing
Cons
- Huge learning curve
- Suitable only for mature application
- Slow and computational heavy
Summary
- Fuzzing is testing with random input
- Use coverage stat to increase fuzzing accuracy
- Use grammar to improve seed variety
- Effective to test critical & mature part of the system
References
- https://www.fuzzingbook.org
- https://www.cs.dartmouth.edu/~mckeeman/reference
s/DifferentialTestingForSoftware.pdf
Thank you
for listening

Introduction to fuzzing

Editor's Notes

  • #6 For the sake of simplicity, we’ll focus on text parameters only
  • #14 The most popular fuzzer - also use coverage-based mutational fuzzing - its success motivates a lot of research in fuzzer and security One of the fuzzing engine behinds OSS-Fuzz
  • #15 http://lcamtuf.coredump.cx/afl/demo/