Mining input grammars from dynamic control flow
Rahul Gopinath, Björn Mathis, Andreas Zeller
Abstract
One of the key properties of a program is its input specification. Having a formal input specification can be critical in fields such as vulnerability analysis, reverse engineering, software testing, clone detection, or refactoring. Unfortunately, accurate input specifications for typical programs are often unavailable or out of date.
In this paper, we present a general algorithm that takes a program and a small set of sample inputs and automatically infers a readable context-free grammar capturing the input language of the program. We infer the syntactic input structure only by observing access of input characters at different locations of the input parser. This works on all stack based recursive descent input parsers, including parser combinators, and works entirely without program specific heuristics. Our Mimid prototype produced accurate and readable grammars for a variety of evaluation subjects, including complex languages such as JSON, TinyC, and JavaScript.
• Software and its engineering → Software reverse engineering; Dynamic analysis; • Theory of computation → Grammars and context-free languages.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Cited by top-tier papers20
- Griffin : Grammar-Free DBMS FuzzingJingzhou Fu, Jie Liang, Zhiyong Wu, Mingzhe Wang et al.ASE 2022 · 44 citations
- Learning input tokens for effective fuzzingBjörn Mathis, Rahul Gopinath, Andreas ZellerISSTA 2020 · 27 citations
- Learning Highly Recursive Input GrammarsNeil Kulkarni, Caroline Lemieux, Koushik SenASE 2021 · 24 citations
- Abstracting failure-inducing inputsRahul Gopinath, Alexander Kampmann, Nikolas Havrikov, Ezekiel O. Soremekun et al.ISSTA 2020 · 22 citations
- Lifting Network Protocol Implementation to Precise Format Specification with Security ApplicationsQingkai Shi, Junyang Shao, Yapeng Ye, Mingwei Zheng et al.CCS 2023 · 15 citations
Builds on4
- NAUTILUS: Fishing for Deep Bugs with GrammarsCornelius Aschermann, Tommaso Frassetto, Thorsten Holz, Patrick Jauernig et al.NDSS 2019 · 291 citations
- NEUZZ: Efficient Fuzzing with Neural Program SmoothingDongdong She, Kexin Pei, Dave Epstein, Junfeng Yang et al.S&P 2019 · 220 citations
- GRIMOIRE: Synthesizing Structure while FuzzingTim Blazytko, Cornelius Aschermann, Moritz Schlögel, Ali Abbasi et al.USENIX Security 2019 · 123 citations
- Debugging inputsLukas Kirschner, Ezekiel O. Soremekun, Andreas ZellerICSE 2020 · 15 citations
Related papers
- How Good are Input Grammar Miners? An Empirical StudyLeon Bettscheider, Andreas ZellerICSE 2026
- Static Inference of Regular Grammars for Ad Hoc ParsersMichael Schröder, Jürgen CitoOOPSLA 2025 · 1 citation
- "Synthesizing input grammars": a replication studyBachir Bendrissou, Rahul Gopinath, Andreas ZellerPLDI 2022 · 8 citations
- V-Star: Learning Visibly Pushdown Grammars from Program InputsXiaodong Jia, Gang TanPLDI 2024 · 4 citations
- Fast Deterministic Black-box Context-free Grammar InferenceMohammad Rifat Arefin, Suraj Shetiya, Zili Wang, Christoph CsallnerICSE 2024 · 4 citations
