Software Engineering
New approach boosts grammar inference accuracy for large-scale program analysis
A technique called Xvada outperforms existing methods at automatically learning the underlying structure of large programming languages from black-box testing.
Researchers have developed a method to reverse-engineer the formal grammar rules that govern large programming languages and systems without having access to their source code—a capability essential for security analysis, fuzzing, and program comprehension.
The Challenge of Grammar Inference#
Determining the precise syntactic structure of a language by observing its behavior from the outside is a longstanding problem in computer science. Prior attempts like Arvada, TreeVada, Kedavra, and Cucio faced significant limitations: they did not scale well to larger systems, often produced inaccurate results, and generated grammars that were difficult to read and interpret. These shortcomings have prevented wider adoption of automated grammar discovery techniques.
Introducing Xvada#
A new approach called Xvada tackles these issues head-on through deterministic inference strategies designed specifically for the black-box setting. When tested against existing methods in a study that carefully avoided measurement pitfalls of previous research, Xvada surpassed the best-performing competitor (TreeVada) in both how accurately it reconstructed grammar rules and how concisely it expressed them.
Real-World Security Impact#
The technique's value extends beyond the laboratory. Using grammars inferred by Xvada, researchers discovered a previously unknown vulnerability (CVE) in Python's widely deployed Liquid template engine. Follow-up fuzzing guided by the inferred grammar uncovered five additional bugs, all of which the Python Liquid developers subsequently addressed. The researchers have released both Xvada and their complete experimental data and scripts for community use.