Structured Input Fuzzing
What You'll Learn
You'll learn how to fuzz complex file formats and protocols intelligently by respecting their underlying structure, rather than blindly mutating bytes.
The Problem with Blind Fuzzing
Imagine trying to break a combination lock by randomly changing numbers—you might get lucky, but it's inefficient. Traditional mutation-based fuzzing often hits the same problem with structured data: it generates invalid inputs that get rejected immediately by parsers, never reaching deeper application logic.
When you fuzz a PDF file, JSON API, or network protocol by flipping random bytes, most mutations create syntactically invalid inputs. The parser rejects them instantly, and you never test the interesting code paths that process valid but malicious structures.
Grammar-Aware Fuzzing
Structured input fuzzing uses knowledge of the target's format—its grammar, schema, or protocol specification—to generate valid but unexpected inputs. Instead of creating garbage, you create well-formed weirdness.
How It Works
- Define the structure: Use format specifications (JSON schemas, protocol RFCs, file format specs) or reverse-engineer the grammar
- Generate valid variants: Create inputs that parse correctly but have unusual combinations—deeply nested structures, extreme values, boundary conditions
- Target semantic bugs: Focus on logic errors, resource exhaustion, and business logic flaws rather than just parser crashes
Example Targets
- File formats: Generate PDFs with circular references, JPEGs with unusual color spaces, or XML with deeply nested entities
- Protocols: Create valid HTTP requests with contradictory headers or oversized field combinations
- APIs: Generate JSON payloads with valid syntax but unexpected type combinations
Tools like Peach Fuzzer, Dharma, and custom grammar-based generators excel at this approach.
Key Takeaway:
Structured input fuzzing respects format grammars to generate valid but malicious inputs, bypassing simple parser checks and reaching deeper application logic where semantic vulnerabilities hide.