Course contentsShow
← Security
Lesson 1387 of 3,05228. Application Security - TestingFree lesson

Generation-Based Fuzzing

Understand how generation-based fuzzers create inputs from scratch using format specifications or grammars.

Generation-Based Fuzzing

What you'll learn: How generation-based fuzzers create test inputs from scratch using structured specifications instead of mutating existing samples.


What Makes It Different

In mutation-based fuzzing (which you just learned), you take existing valid inputs and randomly tweak them. Generation-based fuzzing takes the opposite approach: it builds inputs from the ground up using formal rules that describe what valid data should look like.

Think of it like cooking. Mutation-based fuzzing is like taking an existing recipe and randomly swapping ingredients. Generation-based fuzzing is like having a cookbook that defines the structure of recipes (intro, ingredients list, instructions) and systematically creating new dishes by following those rules—while occasionally breaking them on purpose.

How It Works

Generation-based fuzzers rely on format specifications or grammars that define the structure of valid inputs:

  • File format specifications (XML schemas, JSON structures, protocol definitions)
  • Grammar rules (for parsers, compilers, markup languages)
  • Protocol specifications (network protocols, API contracts)

The fuzzer reads these specifications and generates inputs that:

  1. Mostly conform to the format (to get past initial validation)
  2. Strategically violate edge cases (oversized fields, missing required elements, nested structures)
  3. Explore boundary conditions defined by the specification

Why Use It

Generation-based fuzzing excels when:

  • You're testing parsers, compilers, or protocol handlers
  • The input format is complex and highly structured
  • Mutation-based fuzzing struggles to create valid-enough inputs to reach deeper code paths
  • You have access to formal specifications

The trade-off: you must invest time creating or obtaining accurate format specifications.

Key Takeaway: Generation-based fuzzing creates structured test inputs from scratch using format specifications or grammars, making it ideal for testing complex parsers and protocol handlers where structure matters.