[Paper Review] Sample-Free Learning of Input Grammars for Comprehensive Software Fuzzing
This paper presents Pygmalion, a sample-free approach that automatically infers input grammars from program executables alone, using dynamic taint analysis and parser exploration to generate high-coverage, syntactically valid test inputs. The method achieves grammar inference in minutes and produces thousands of high-quality inputs that comprehensively cover and combine language features, outperforming mutation- and constraint-based fuzzers in input quality and feature coverage.
Generating valid test inputs for a program is much easier if one knows the input language. We present first successes for a technique that, given a program P without any input samples or models, learns an input grammar that represents the syntactically valid inputs for P -- a grammar which can then be used for highly effective test generation for P . To this end, we introduce a test generator targeted at input parsers that systematically explores parsing alternatives based on dynamic tracking of constraints; the resulting inputs go into a grammar learner producing a grammar that can then be used for fuzzing. In our evaluation on subjects such as JSON, URL, or Mathexpr, our PYGMALION prototype took only a few minutes to infer grammars and generate thousands of valid high-quality inputs.
Motivation & Objective
- To address the limitation of existing fuzzing techniques that require input samples or formal specifications for effective test input generation.
- To enable comprehensive software fuzzing by automatically learning the input grammar of a program from its executable alone.
- To improve test input quality by generating well-structured, semantically rich inputs that cover and combine syntactic features.
- To provide a grammar inference pipeline that is sample-free, automated, and reusable across different programs and input formats.
- To demonstrate that grammar inference from execution alone can match or exceed the coverage of constraint-based and mutation-based fuzzing techniques.
Proposed method
- A parser-directed test generator dynamically tracks comparisons between input characters and expected values during parsing, using dynamic taint analysis to guide input generation that satisfies parsing constraints.
- The system systematically explores all parsing alternatives by iteratively generating inputs that trigger different comparison outcomes, ensuring coverage of all syntactic paths.
- A grammar learner analyzes the data flow of input characters across execution to group sequences with identical flow into syntactic entities and infer composition rules.
- Equivalence classes derived from the test generator's exploration (e.g., 'any digit') are used to generalize grammar rules, improving abstraction and coverage.
- The inferred grammar is then used as a high-speed producer for fuzzing, generating valid inputs without further instrumentation or program execution.
- The pipeline is fully automated and requires only the program executable and a valid input prefix (e.g., empty string) as input.
Experimental results
Research questions
- RQ1Can an input grammar be accurately inferred for a program without any input samples or formal specifications?
- RQ2Can dynamic taint analysis and parser exploration be used to systematically cover all syntactic alternatives in a program’s input parser?
- RQ3Can the resulting grammar enable the generation of high-coverage, semantically rich test inputs that combine multiple language features?
- RQ4How does grammar-based fuzzing without samples compare to mutation-based and constraint-based approaches in terms of input validity and code coverage?
- RQ5To what extent can the inferred grammar be reused for testing, program understanding, or input validation across different tools and systems?
Key findings
- Pygmalion inferred accurate input grammars for JSON, URL, and Mathexpr in under five minutes using only the program executable.
- The system generated thousands of valid, high-quality test inputs that comprehensively combined syntactic features such as arrays, objects, strings, and numbers in JSON.
- For JSON, the longest Pygmalion input combined multiple complex elements, including nested structures and special characters, while AFL and Klee produced only simple, repetitive inputs.
- In coverage metrics, Pygmalion achieved near-maximal code coverage on valid inputs, matching or exceeding Klee in all cases except for URL query parsing, where Klee had a minor edge.
- Over 90% of Pygmalion’s inputs were valid, significantly outperforming AFL and Klee, which produced mostly invalid inputs due to syntactic flaws.
- The inferred grammars enabled precise control over input structure, depth, and symbol frequency, offering superior test case design capabilities compared to mutation-based approaches.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.