Skip to the content ForoHackers
Log inJoin

Fuzzing: start here

Fuzzing
#3301 · · Quote · Report

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

  1. How the program under test parses input, and which bugs a parser tends to have.
  2. Write a tiny parser in C with a deliberate bug of your own, and a harness for it.
  3. Fuzz it with a coverage-guided open-source fuzzer, compiled with sanitisers.
  4. Build a good seed corpus and a dictionary of tokens, and compare coverage with and without them.
  5. 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

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply