Fuzzing is automated testing with huge numbers of generated, malformed or random inputs, watching for crashes, hangs and sanitiser reports. It finds the bugs nobody thought to write a test for, especially in parsers and protocol code. Fuzz your own software, or open-source code on your own machine, and report what you find.
Key concepts
- Input generation: random mutation of samples, or generation from a grammar or format description.
- Coverage guidance: instrument the program, keep the inputs that reach new code, and mutate those further.
- Oracles: a crash is only one signal; sanitisers turn silent memory errors into loud failures.
- Harnesses: a small function that feeds bytes to the code under test, fast and without side effects.
- Triage: reduce a crashing input, group duplicates and find the root cause.
Vocabulary
- Corpus: the set of interesting inputs the fuzzer keeps.
- Sanitiser: a compiler option that detects memory and undefined-behaviour errors at run time.
- Seed: a valid input a fuzzer starts from.
- Minimisation: shrinking a crashing input to the smallest that still fails.
What to study, in order
- How the program under test parses input, and which bugs a parser tends to have.
- Write a tiny parser in C with a deliberate bug of your own, and a harness for it.
- Fuzz it with a coverage-guided open-source fuzzer, compiled with sanitisers.
- Build a good seed corpus and a dictionary of tokens, and compare coverage with and without them.
- Fuzz a small open-source library on your machine; minimise each crash, find its root cause and write a regression test.
Related tags
#vulnerability-research #testing #static-analysis #c #protocol-analysis