The Fuzzer Reached the Code, yet Missed the State: LLM-Guided JavaScript Engine Fuzzing
Wai Kin Wong (Postdoctoral Researcher · HKUST), Dongwei Xiao (HKUST), Shuai Wang (Professor · HKUST)
[un]prompted.au 2026 · Day 2 · Main Hall
Overview
In this insightful talk from [un]prompted.au, Wai Kin Wong, a postdoctoral researcher at HKUST, introduced StateLens, a novel approach to enhance JavaScript engine fuzzing by leveraging Large Language Models (LLMs) to identify and instrument critical internal states. Co-developed with Dongwei Xiao and Professor Shuai Wang, StateLens addresses a fundamental limitation of traditional coverage-guided fuzzing: while it excels at reaching new code paths, it often fails to recognize the diverse conditions or states under which that code is executed. This oversight can lead to missed vulnerabilities, particularly in highly stateful and optimized systems like JavaScript engines such as V8.

Key moments
- 0:00 Introduction and motivation for LLM-guided fuzzing
- 4:30 Limitations of traditional coverage-guided fuzzing for JS engines
- 8:30 StateLens architecture: LLMs leverage developer artifacts for probes
- 10:00 Detailed walkthrough of StateLens applying probes to V8
- 20:00 Real-world V8 IdentityMap bug discovered by StateLens
- 25:30 Key takeaways: The value of state observation and LLMs
- 26:40 Q&A: How StateLens selects security-relevant internal states
- 29:00 Q&A: False positive rate and instrumentation side effects
The Fuzzer Reached the Code, yet Missed the State: LLM-Guided JavaScript Engine Fuzzing
Speakers: Wai Kin Wong (Postdoctoral Researcher, HKUST); Dongwei Xiao (HKUST); Shuai Wang (Professor, HKUST)
Conference: [un]prompted.au
YouTube: https://www.youtube.com/watch?v=T2mINp9NAX0
Overview
In this insightful talk from [un]prompted.au, Wai Kin Wong, a postdoctoral researcher at HKUST, introduced StateLens, a novel approach to enhance JavaScript engine fuzzing by leveraging Large Language Models (LLMs) to identify and instrument critical internal states. Co-developed with Dongwei Xiao and Professor Shuai Wang, StateLens addresses a fundamental limitation of traditional coverage-guided fuzzing: while it excels at reaching new code paths, it often fails to recognize the diverse conditions or states under which that code is executed. This oversight can lead to missed vulnerabilities, particularly in highly stateful and optimized systems like JavaScript engines such as V8.
Wong highlights that interesting and exploitable bugs in complex software often arise from intricate interactions between multiple engine subsystems in very precise manners, rather than simple logic errors. Standard fuzzing techniques, relying on line or edge coverage, are too coarse-grained to capture these nuanced state transitions. StateLens proposes a solution by intelligently extracting developer knowledge embedded in assertions, comments, and bug reports, and using LLMs to translate this contextual information into targeted instrumentation. This allows fuzzers to gain a more fine-grained understanding of execution, leading to the discovery of subtle yet critical vulnerabilities that have eluded detection for years.
The significance of StateLens lies in its ability to bridge the gap between human understanding of complex system behaviors and automated testing. By empowering fuzzers with "state coverage" feedback, it offers a powerful new dimension for vulnerability research, making the hunt for elusive zero-day exploits more efficient and effective. This research not only advances the field of software testing but also demonstrates a practical, impactful application of LLMs in cybersecurity, moving beyond mere code generation to intelligent test guidance.
Background
▶ Watch: Introduction and motivation for LLM-guided fuzzing (0:00)
The landscape of modern software security is characterized by increasingly complex systems, where vulnerabilities often stem from subtle interactions rather than straightforward coding errors. JavaScript engines, being high-performance, highly optimized virtual machines, are prime examples of such complexity. They manage intricate object layouts, garbage collection (GC) mechanisms, caching strategies, and just-in-time (JIT) compilation, all of which are deeply interconnected and state-dependent.
Traditional fuzzing, particularly coverage-guided fuzzing (e.g., using tools like AFL or Fuzzilli), has been remarkably successful in discovering bugs by systematically exploring code paths. These fuzzers typically rely on structural coverage metrics, such as line coverage or edge coverage, to determine if a generated test case has explored a new part of the codebase. If a test case hits previously unreached code, it's deemed "interesting" and used as a seed for further mutations. However, as Wong points out, this approach has a critical blind spot: "reaching a simple code region or line of code doesn't necessarily mean that we have exercised the same behavior." The conditions or internal states under which a specific line of code is executed can vary dramatically, even if the same lines are traversed. For instance, the same operation in a JavaScript engine might encounter different object layouts, cache states, or GC conditions, leading to entirely different execution outcomes and potential vulnerabilities.
This "code reached, yet missed the state" problem is particularly acute in JavaScript engines. An assertion might hold true under one set of conditions but fail under another, even if the same control flow path is taken. Identifying these critical state transitions and their impact on program behavior is extremely challenging for automated tools that only observe code execution paths. Manually instrumenting for every possible state combination is infeasible due to the sheer volume of changing values and the high memory/performance cost. The core problem, therefore, is to identify which states are relevant to track and where to observe them effectively, especially when critical state changes might be established in one function and exploited much later in another, often across multiple interacting subsystems. This is where StateLens introduces its innovative LLM-guided approach, moving beyond simple code coverage to a more nuanced "state coverage."
Key Findings
▶ Watch: StateLens architecture: LLMs leverage developer artifacts for probes (8:30)
The central discovery and contribution of StateLens is the concept of LLM-guided state coverage for fuzzing complex software, specifically JavaScript engines. The key insight is that while the internal states of a JavaScript engine are vast and complex, developers themselves leave a wealth of clues about critical state transitions and invariants within the codebase. These clues manifest as assertions, comments, design documentation, and bug reports. StateLens's core finding is that Large Language Models can be effectively leveraged to "connect these clues together" and translate this scattered human knowledge into concrete, actionable instrumentation for fuzzers.
The primary findings can be summarized as:
- Limitations of Code Coverage: Traditional fuzzers, relying solely on line or edge coverage, are insufficient for finding bugs arising from subtle state interactions in complex systems like JavaScript engines. Reaching a code path does not guarantee exercising all relevant behavioral conditions.
- Developer Artifacts as Goldmines: Developers inherently embed critical information about expected states, invariants, and potential failure modes directly into the source code and related documentation. These artifacts are a rich, untapped resource for identifying security-relevant state variables and transitions.
- LLMs for Contextual Instrumentation: LLMs possess the capability to understand natural language and code context, allowing them to:
- Query and filter relevant information from a database of developer artifacts (e.g., regression tests, patches, documentation).
- Perform static analysis (like call graph reachability) to trace dependencies and interactions related to identified state changes.
- Synthesize this information into "state reports" that pinpoint specific variables and locations for instrumentation.
- Generate precise probes or instrumentation code that captures "before and after" state combinations, providing a more granular feedback signal to the fuzzer than simple code execution.
- Enhanced Fuzzing Effectiveness: By integrating this LLM-guided state coverage into a standard fuzzing pipeline, StateLens enables fuzzers to:
- Discover novel, subtle vulnerabilities that traditional coverage-guided fuzzers miss.
- Identify long-standing bugs that have existed in the codebase for years but only become exploitable under specific, hard-to-reach state conditions.
- Provide feedback for further mutation or minimization, even when no new code edges are hit, by identifying previously unseen state combinations.
- Targeted and Efficient Fuzzing: The LLM's role is not to generate every test case or directly find bugs, but to intelligently guide the fuzzer by deciding "what kind of testing should be matters and where the fuzzer or other static analysis tools should be exploring." This reduces the overall cost of fuzzing by focusing on relevant state changes rather than exhaustive, noisy observation.
In essence, StateLens demonstrates a paradigm shift where LLMs act as intelligent assistants, translating implicit developer knowledge into explicit testing guidance, thus making fuzzing far more sensitive to the intricate state-dependent behaviors that often harbor critical vulnerabilities.
Technical Deep Dive
▶ Watch: Real-world V8 IdentityMap bug discovered by StateLens (20:00)
StateLens operates through a sophisticated two-component architecture: an offline component for knowledge extraction and an online component for guided fuzzing. This design optimizes the use of LLMs by performing computationally intensive analysis beforehand, allowing for efficient, state-aware fuzzing.
The offline component begins by building a comprehensive database of developer artifacts. This includes diverse sources such as:
- Regression tests: Examples of how developers test specific functionalities and bug fixes.
- Patches: Records of previous bug fixes, often containing insights into vulnerability patterns and critical code changes.
- Documentation: Design documents, comments, and internal specifications that describe expected behaviors and invariants of the JavaScript engine.
- Bug reports: Detailed descriptions of discovered issues, often highlighting precise conditions that lead to failures.
Once this database is established, LLMs perform offline analysis to extract useful information. The process starts with a specific point of interest in the source code, such as an assertion or a critical operation. For instance, Wong illustrates this with two lines of V8 source code related to map updates (an internal V8 data structure, distinct from JavaScript's Map collection). One line updates the layout, and an assertion expects the result to remain in "fast property storage." The goal is to understand when this update might change the storage mode and why it matters.
The LLM queries the artifact database with relevant terms (e.g., "map update map storage mode transition"). The initial results might be broad, so a filtering step is crucial. The LLM evaluates the candidates, rejecting irrelevant ones (e.g., those discussing JavaScript collections when the focus is on V8 internal maps). This iterative querying and filtering refines the search to more specific clues, such as function names like Map::PrepareForDataProperty and Map::Update.
Next, static analysis with call graph reachability is performed. From the identified starting points, the system traces callers (to understand how object layouts are used) and migration points (to explain how layouts can change). This analysis is not exhaustive; instead, it focuses on establishing important connections between changes and the code that relies on those changes. The LLM processes this call graph information to identify critical points of interaction and potential state dependencies.
The output of this offline analysis is a state report. This report consolidates the extracted knowledge, detailing potential issues, relevant functions, and variables that influence critical state transitions. For the V8 map example, the report might indicate that "a getter can run while a property is being copied and its side effect can leave the target transition map outdated," leading to a situation where "later property writes still expect fast storage." The critical question becomes: "Does an outdated map remain fast or become a dictionary map?" This report serves as the blueprint for instrumentation.
The final step in the offline phase is generating the probes for instrumentation. This requires careful selection of which objects and which variables to observe. For instance, a variable named stable might seem promising, but if it checks the source object while the property is added to a different target object, it might not directly describe the relevant change. The LLM-guided process identifies specific variables like depletion flags and storage mode within the Map::Update function, and determines that recording their "before and after" values is essential. The instrumentation ensures that it "keeps enough information to describe what happened and when it did it" without causing side effects to the engine's execution. This means not altering the engine's logic or bug checks, but merely adding observation points. The result is an instrumented function that records a before and after combination of states, providing a much richer feedback signal to the fuzzer. This "state coverage" allows the fuzzer to identify new behaviors even without hitting new code edges, simply by encountering a previously unseen state combination.
The online component then integrates this patched or instrumented engine into a standard fuzzing loop, such as one provided by Fuzzilli. The state coverage signals, generated by the LLM-crafted probes, serve as an additional feedback mechanism to the fuzzer. This augments traditional coverage signals, guiding the fuzzer to prioritize inputs that trigger new or interesting state transitions. By reducing the overall cost of online test case generation and focusing on relevant state changes, StateLens makes the fuzzing process significantly more efficient and effective in uncovering subtle, state-dependent vulnerabilities.
Demo / Proof of Concept
▶ Watch: Key takeaways: The value of state observation and LLMs (25:30)
While the talk didn't feature a live coding demo, Wong presented a compelling proof of concept through a real-world V8 vulnerability discovered by StateLens, which was reported to Chromium bugs. This bug involves V8's IdentityMap, a data structure distinct from the object layout map discussed earlier.
The core of the bug lies in how the IdentityMap handles objects in the shared heap during garbage collection (GC). The IdentityMap associates live objects with records, and its lookup position depends on the object's memory address. The problem arises when a GC event moves an object in the shared heap, changing its address.
Here's a step-by-step breakdown of the bug:
- Initial State: An object
Shas addressA. HashingAleads toslot 2in theIdentityMap, whererecord 1is stored. The table also records theworker's GC count(e.g., 5). This count is used to detect if a GC has occurred and the table needs rebuilding. - Shared Heap GC: A garbage collection occurs in the shared heap. This event moves object
Sfrom addressAto a new addressB. Crucially, while the stored key inslot 2is updated toB(so it's not a dangling pointer), the entry itself remains inslot 2, where the old addressAoriginally placed it. - GC Counter Mismatch: The shared collector's GC count advances (e.g., to 6), reflecting the collection. However, the worker's GC count (which the
IdentityMapwatches) remains at 5. - False Miss: Later, when the worker tries to find object
Sagain, it uses its new addressB. HashingBleads to a different slot (e.g.,slot 6), which is empty. TheIdentityMapchecks if itsworker's GC counthas changed. Since5is still5, it skips the rebuild and retry mechanism that is designed to recover from object movements. The result: the lookup forSat addressBfails, reporting a false miss, even though the object is alive and its record (record 1) is still in the table atslot 2. - Double Insertion: If the caller responds to this false miss by attempting to insert the object
S(assuming it's missing), a second problem arises. TheIdentityMapwill insert a newrecord 2forSatslot 6. Now, the same live objectSis associated with two distinct records (record 1atslot 2andrecord 2atslot 6), leading to inconsistent bookkeeping and potential memory corruption (e.g., use-after-free, arbitrary read/write).
StateLens's contribution to discovering this bug is attributed to two specific probes added by the LLM:
- Probe 1: Object Type and Memory Region: This probe recorded the object's type along with its memory region. This was crucial because simply knowing a compiler's constant handling code was reached didn't reveal where the object lived. Detecting that a string was in shared space produced a distinct observation from previously seen constants, highlighting the unique context.
- Probe 2: Collector Type and Reason: This probe recorded which collector ran (e.g., shared collector vs. worker collector) and why the collection was requested. A new combination of collector type and reason provided the fuzzer with a novel distinction to explore, leading it to the specific GC scenario that triggered the bug.
The fix, implemented by the V8 team, was "quite simple" conceptually: the IdentityMap was modified to learn about GC events more directly. Instead of solely inferring from the worker's GC count, the collector now notifies affected maps and marks them as invalidated. On a later miss, the map rebuilds from the current address and retries, correctly finding the entry. This ensures the IdentityMap is aware of shared heap movements.
Wong emphasized the significance of this bug: it had existed in the V8 codebase since 2015 and became exploitable after 2021. While its exploitation requires a race condition and is "quite challenging," it could lead to "heap read or write" primitives, underscoring the severity of such subtle state-dependent flaws. The discovery of this long-standing, complex bug highlights StateLens's capability to uncover deep vulnerabilities that evade conventional fuzzing for years.
Defensive Implications
▶ Watch: Q&A: False positive rate and instrumentation side effects (29:00)
The research presented by StateLens carries significant implications for software defenders and developers, particularly those working on complex, high-performance systems like JavaScript engines, operating systems, or virtual machines. The core message is clear: traditional code coverage is not enough; state coverage is critical for robust security.
- Adopt State-Aware Testing Methodologies: Organizations developing complex software should move beyond rudimentary line and edge coverage metrics for their fuzzing campaigns. Integrating state-aware feedback, similar to StateLens's approach, can dramatically improve the efficacy of vulnerability discovery. This might involve:
- Identifying critical state variables: Developers should proactively document and highlight internal states that are security-sensitive or prone to intricate interactions.
- Instrumenting for state transitions: Rather than just tracking code execution, implement mechanisms to record "before and after" values of key state variables at critical junctures.
- Leveraging developer artifacts: Treat internal documentation, assertions, and bug reports as rich sources of security-relevant information. These are implicit specifications of expected behavior and can guide more targeted testing.
- Explore LLM Integration in SDLC: The use of LLMs in StateLens demonstrates a powerful application beyond simple code generation. Defenders could investigate integrating LLMs into various stages of their Secure Software Development Life Cycle (SSDLC):
- Automated vulnerability hypothesis generation: LLMs could analyze code and documentation to suggest potential weak points related to state management.
- Automated test case enhancement: LLMs could guide the generation of more effective test cases by identifying specific scenarios that stress state transitions.
- Intelligent instrumentation: Similar to StateLens, LLMs could assist in automatically generating probes for dynamic analysis tools, tailored to the specific context of the codebase.
- Prioritize Clarity in Code and Documentation: The success of StateLens hinges on the existence of developer artifacts. This reinforces the importance of:
- Clear and precise assertions: Assertions should not just validate basic conditions but also critical state invariants.
- Informative comments: Comments should explain why certain design choices were made, what states are expected, and what potential side effects exist.
- Detailed bug reports: Comprehensive bug reports that describe the exact sequence of events and the resulting state changes are invaluable for future analysis and tooling.
- Focus on Shared Memory and Concurrency: The V8 IdentityMap bug highlights the particular challenges associated with shared memory, garbage collection, and concurrency. These areas are notoriously difficult to test and often harbor subtle race conditions and state inconsistencies. Defenders should:
- Increase scrutiny on shared data structures: Pay extra attention to data structures accessed by multiple threads or different parts of a system with independent state management (e.g., separate GC counters).
- Fuzz with diverse GC triggers: Ensure fuzzing campaigns can trigger various types of garbage collections (e.g., shared heap, worker-specific) and observe their interactions with critical data.
- Continuous Improvement of Fuzzing Harnesses: The talk mentions the difficulty of manually coding LLM harnesses in earlier stages. As LLM capabilities evolve, defenders should continuously update and refine their fuzzing infrastructure to integrate these advanced guidance mechanisms. This includes developing robust pipelines to handle LLM outputs, validate generated instrumentation, and manage potential side effects.
By embracing state-aware testing and intelligently leveraging advanced AI tools like LLMs, defenders can significantly enhance their ability to detect and mitigate complex, deeply embedded vulnerabilities that have historically proven elusive to traditional security testing methods.
Key Takeaways
- State Matters as Much as Code Coverage: In complex, stateful systems like JavaScript engines, merely reaching a specific line of code is insufficient for thorough testing. The conditions or internal states under which that code executes are equally, if not more, important for discovering subtle vulnerabilities.
- Developer Artifacts are Untapped Security Intelligence: Assertions, comments, design documentation, and bug reports created by developers contain invaluable implicit knowledge about critical state transitions and invariants. These human-generated clues can be leveraged to guide automated security testing.
- LLMs as Intelligent Fuzzing Guides: Large Language Models can effectively analyze developer artifacts and source code to identify security-relevant internal states, perform static analysis for reachability, and generate precise instrumentation (probes) to capture "state coverage." Their role is to guide fuzzers, not to generate all tests.
- Enhanced Vulnerability Discovery: By providing "before and after" state feedback, StateLens enables fuzzers to detect novel state combinations, leading to the discovery of deep, long-standing, and complex vulnerabilities (like the V8 IdentityMap bug) that traditional coverage-guided fuzzers often miss.
- Avoid Overfitting to Known Patterns: The LLM-guided approach avoids overfitting to known bug patterns by focusing on general state observability, allowing for the discovery of unexpected interaction bugs, such as those related to subtle garbage collection impacts.
About the Speaker(s)
Wai Kin Wong is a Postdoctoral Researcher in the Computer Science and Engineering (CSE) department at the Hong Kong University of Science and Technology (HKUST). His research primarily focuses on software testing and binary analysis, including areas like binary similarity and decompilation. In this talk, Wong presented his work on StateLens, a novel LLM-guided approach to JavaScript engine fuzzing, developed in collaboration with Dongwei Xiao and Professor Shuai Wang. Professor Shuai Wang, also from HKUST, is recognized as a top researcher in cybersecurity, providing significant leadership and expertise to the team's efforts in advancing software testing methodologies. Wong's presentation showcased his expertise in bridging advanced AI techniques with practical cybersecurity challenges to enhance vulnerability discovery.
Reviews
Dr. Zero (Offensive Security Researcher) — STRONG ACCEPT
Finally, an 'AI-powered' security talk that isn't absolute bullshit. Wong and the HKUST crew actually used LLMs to solve a real bottleneck: instrumenting state transitions in V8 without grinding the fuzzer to a halt. It’s a smart, pragmatic approach that netted a seven-year-old V8 bug, making this a mandatory watch for anyone in the JS fuzzing trenches.
Heather Calloway (CISO) — SOLID
This is a deep-technical research presentation on using LLMs to improve vulnerability discovery in JavaScript engines. It is not a governance talk, but it clearly demonstrates that AI is accelerating the discovery of zero-days in foundational enterprise software, which directly impacts our patching strategies.