Montage: A Neural Network Language Model-Guided JavaScript Engine Fuzzer

Suyoung Lee, HyungSeok Han, Sang Kil Cha, Sooel Son · OpenReview

Introduction

JavaScript (JS) engines are critical components of modern web browsers, serving as high-value targets for security researchers and attackers alike. To identify vulnerabilities, researchers typically employ fuzzing—the automated generation of massive amounts of code to trigger crashes or unexpected behavior.

However, JS is a highly structured language. Traditional fuzzers often generate random strings that are immediately rejected by an engine's parser. While "grammar-aware" fuzzers can produce syntactically correct code, they frequently lack the "intuition" required to combine code fragments in ways that trigger deep, logic-based bugs. Furthermore, many generated tests fail due to simple semantic errors, such as reference errors (calling undefined functions). Montage addresses these challenges by using a Long Short-Term Memory (LSTM) network to "regrow" Abstract Syntax Tree (AST) fragments, generating syntactically valid and semantically complex test cases.

Methodology

Montage introduces a model-guided fuzzing approach divided into three distinct phases to ensure both structural validity and bug-finding efficacy.

Overview of the Montage fuzzing pipeline, illustrating the three phases from AST fragmentation to test generation.

Phase I: AST Fragmentation

Instead of training on raw text or simple tokens, Montage decomposes JS code into an AST. The system slices this tree into "fragments"—small subtrees consisting of a parent node and its immediate children (a depth of one). This representation allows the model to capture the hierarchical structure of the language more effectively than character-level models.

Phase II: LSTM Training

An LSTM network is trained on these fragment sequences. The model learns the compositional relationships between fragments, essentially gaining an intuition for which code structures are likely to follow others in real-world JavaScript. This allows the fuzzer to predict the next logical "piece" of a program.

Phase III: Mutative Generation and Reference Resolution

Montage does not build tests from scratch. It utilizes a "seed" (an existing regression test), prunes a random branch of its AST, and uses the trained LSTM to iteratively regrow that branch fragment by fragment. To ensure the resulting code is executable, Montage performs static analysis to map undeclared identifiers to existing ones in the current scope, significantly increasing the "pass rate" of the generated code.

Key Insights: The "95% Overlap" Rule

A core motivation for Montage is the observation that security vulnerabilities often cluster near previously patched areas. By using regression tests as seeds, Montage focuses its search on high-risk neighborhoods.

Analysis of common fragments in known PoC files, supporting the hypothesis that exploits reuse existing code structures.

Furthermore, a preliminary study by the authors revealed that 95.9% of the code fragments used in known Proof-of-Concept (PoC) exploits already existed in the engines' own regression tests. This suggests that discovering new bugs does not necessarily require inventing new language constructs, but rather finding novel ways to compose existing ones. By training on AST fragments, Montage inherently respects the hierarchical nature of JS, leading to higher quality test cases than previous neural-guided attempts.

Evaluation and Results

Montage was evaluated against state-of-the-art fuzzers, including CodeAlchemist, jsfunfuzz, and IFuzzer, using a corpus of 1.7 million lines of code from major engines like V8, ChakraCore, SpiderMonkey, and JavaScriptCore.

  • Bug Discovery: Montage discovered 37 unique real-world bugs in the latest versions of major engines. Of these, 34 were found in ChakraCore, 2 in JavaScriptCore, and 1 in V8.
  • Security Impact: Three of these bugs were assigned CVE IDs (CVE-2019-0860, CVE-2019-0923, and CVE-2019-8594). The authors were awarded a $5,000 bounty for one of these critical vulnerabilities.
  • Efficiency and Validity: In head-to-head trials, Montage found 133 bugs in an older version of ChakraCore, more than doubling the performance of its closest competitors. It achieved a code pass rate of 60-80%, significantly higher than previous token-level neural models.

Conclusion and Future Work

Montage demonstrates that neural language models, when guided by structural AST fragments, can significantly improve the efficiency of JS engine fuzzing. While the model's predictive accuracy can decrease as ASTs grow larger (leading to "bloated" code), and static analysis has limitations with dynamic JS behaviors like hoisting, the results are a major step forward.

Future research may involve integrating more sophisticated semantic analysis or exploring Transformer-based architectures to further enhance the fuzzer's ability to generate complex, bug-triggering code sequences.

Summary updated

BibTeX
@misc{lee2020montage,
  author = {Suyoung Lee and HyungSeok Han and Sang Kil Cha and Sooel Son},
  title = {{Montage: A Neural Network Language Model-Guided JavaScript Engine Fuzzer}},
  year = {2020},
  eprint = {2001.04107},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2001.04107},
}
Figure