[Paper Review] Learn&Fuzz: Machine Learning for Input Fuzzing
This paper introduces Learn&Fuzz, a novel machine learning approach that uses sequence-to-sequence recurrent neural networks to automatically learn a generative probabilistic grammar from sample PDF inputs. The method learns the statistical structure of well-formed PDF objects and uses this model to guide intelligent fuzzing, significantly improving code coverage and vulnerability discovery in Microsoft Edge’s PDF parser compared to random and baseline learning-based fuzzing techniques.
Fuzzing consists of repeatedly testing an application with modified, or fuzzed, inputs with the goal of finding security vulnerabilities in input-parsing code. In this paper, we show how to automate the generation of an input grammar suitable for input fuzzing using sample inputs and neural-network-based statistical machine-learning techniques. We present a detailed case study with a complex input format, namely PDF, and a large complex security-critical parser for this format, namely, the PDF parser embedded in Microsoft's new Edge browser. We discuss (and measure) the tension between conflicting learning and fuzzing goals: learning wants to capture the structure of well-formed inputs, while fuzzing wants to break that structure in order to cover unexpected code paths and find bugs. We also present a new algorithm for this learn&fuzz challenge which uses a learnt input probability distribution to intelligently guide where to fuzz inputs.
Motivation & Objective
- To address the manual, error-prone process of creating input grammars for grammar-based fuzzing in complex formats like PDF.
- To explore the tension between learning well-formed input structure and injecting malformed inputs to trigger unexpected code paths.
- To develop an automated, end-to-end method that learns a statistical input model from raw sample inputs without program instrumentation.
- To evaluate whether a learned probabilistic model can guide fuzzing more effectively than random or heuristic-based approaches.
Proposed method
- Employing sequence-to-sequence (seq2seq) recurrent neural networks to learn a statistical, generative model of PDF object structure from a corpus of sample inputs.
- Using unsupervised, end-to-end training on raw PDF text to learn the probability distribution of valid input sequences.
- Generating new, well-formed PDF objects by sampling from the trained seq2seq model, preserving syntactic and semantic regularities.
- Applying a novel learn&fuzz algorithm that uses the learned probability distribution to guide where and how to mutate inputs, favoring statistically plausible but structurally diverse mutations.
- Integrating the learned model into a fuzzing pipeline that balances well-formedness (for coverage) and mutation (for bug discovery).
- Evaluating the approach using Microsoft Edge’s PDF parser and measuring code coverage and vulnerability discovery rates.
Experimental results
Research questions
- RQ1Can neural network-based models effectively learn the statistical structure of complex, flat input formats like PDF objects from raw sample inputs?
- RQ2How can a learned input probability distribution be used to guide fuzzing in a way that balances well-formedness and structural mutation?
- RQ3What is the trade-off between learning accurate input structure and generating inputs that trigger unexpected code paths in a parser?
- RQ4Does a learn&fuzz approach outperform random fuzzing and other learning-based fuzzing techniques in terms of code coverage and vulnerability detection?
- RQ5Can the statistical nature of neural models help resolve the inherent conflict between learning and fuzzing goals?
Key findings
- The seq2seq model successfully learned a generative, probabilistic grammar from raw PDF inputs, producing a large number of new, well-formed PDF objects that conform to the format's syntactic rules.
- The learned model achieved higher code coverage in Microsoft Edge’s PDF parser than both random fuzzing and baseline learning-based fuzzing methods.
- The proposed learn&fuzz algorithm, which uses the learned probability distribution to guide mutations, outperformed other fuzzing strategies in exercising diverse code paths.
- The approach demonstrated that statistical modeling via neural networks can effectively capture the complex, flat structure of PDF objects, including diverse key-value pairs and nested types.
- The method achieved measurable improvements in vulnerability discovery, particularly in exercising error-handling and edge-case code paths.
- The results confirm the existence of a fundamental tension between learning well-formed structure and injecting malformed inputs, which the learn&fuzz approach effectively mitigates through guided mutation.
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.