arXiv:2610.21309cs.CROct 2026

Manuscript Offprint

arXiv:2610.21309

Combining LLM and Dynamic Analysis for Universal Testing of Static Application Security Testing Tools

Huaien Zhang, Yu Pei, Hao Chen, Shin Hwei Tan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

HUAIEN ZHANG, The University of Hong Kong and the Hong Kong Polytechnic University, China

YU PEI, The Hong Kong Polytechnic University, China

HAO CHEN, The University of Hong Kong, China

SHIN HWEI TAN, Concordia University, Canada

Static application security testing (SAST) tools help detect potential software vulnerabilities, but they themselves contain faults undermining reliability and usability. Automated testing can address these issues, yet current techniques suffer from limited program transformation diversity and lack mechanisms to verify generated variants, leading to reduced fault detection and high manual effort. We present LLM4SAST, the first universal framework detecting faults in SAST tools using large language models and dynamic feedback. Our key insight is leveraging LLMs to understand and transform code in diverse programming languages. We design novel metamorphic relations with transformations to guide variant generation, using an LLM to produce multi-language variants that satisfy these relations. To reduce erroneous variants and identify unique faults, we propose two heuristics: dynamic-feedback-driven selection and program-differencing-based clustering. For each metamorphic relation, a report-centric test oracle detects variants that fail tests and identifies underlying faults by differentially analyzing SAST reports of the seed program and its variants. LLM4SAST identified 66 unique faults across six SAST tools, with 32 confirmed or fixed after being reported to developers, demonstrating effectiveness. The proposed heuristics eliminate 47.8% of false positives, and LLM4SAST detects 3.4 times more faults while requiring only 39.8% of the variants compared to existing approaches.

CCS Concepts: • Software and its engineering → Software reliability.

Additional Key Words and Phrases: SAST, Software testing, Program analysis, Large language model

ACM Reference Format:

Huaien Zhang, Yu Pei, Hao Chen, and Shin Hwei Tan. 2026. Combining LLM and Dynamic Analysis for Universal Testing of Static Application Security Testing Tools. 1, 1 (October 2026), 21 pages. https://doi.org/XXXXXXX.XXXXXXX

1 Introduction

In the contemporary software development lifecycle, the significance of static application security testing (SAST) tools is paramount. These tools provide a proactive and systematic approach in identifying security vulnerabilities, design flaws, and compliance violations directly within the source code, bytecode, or binary code of an application without dynamic execution. The core value of SAST lies in its ability to facilitate a “Shift-Left” security paradigm, integrating security assessments early in the development phase. This early detection drastically reduces the cost and effort associated with remediating issues later in the software development lifecycle (SDLC), as fixing a vulnerability during

Authors' Contact Information: Huaien Zhang, The University of Hong Kong and the Hong Kong Polytechnic University, Hong Kong, China, huaien@hku.hk; Yu Pei, The Hong Kong Polytechnic University, Hong Kong, China, csypei@comp.polyu.edu.hk; Hao Chen, The University of Hong Kong, Hong Kong, China, chenho@hku.hk; Shin Hwei Tan, Concordia University, Montreal, Canada, shinhwei.tan@concordia.ca.

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.

© 2026 Copyright held by the owner/author(s). Publication rights licensed to ACM.

Huaien et al.

coding is exponentially less expensive than post-deployment. By automating code analysis against a comprehensive knowledge base of known vulnerability patterns (e.g., SQL injection, cross-site scripting, buffer overflows), SAST tools empower developers to write more secure code, foster a culture of security awareness, and ultimately contribute to the delivery of robust and resilient software products in an increasingly threat-prone digital landscape. Hence, ensuring the correctness and reliability of SAST tools is a critical research topic, as their implementation faults can result in both missed detections of security vulnerabilities and a high false positive rate that severely compromises their usability.

Prior research on quality assurance for SAST tools primarily falls into four paradigms: (1) differential testing [47, 55], (2) metamorphic testing [29, 53, 54], (3) random testing [8], and (4) program generation [15]. The differential testing approach [47, 55] identify potential faults by detecting inconsistencies among common internal analysis techniques, which rely on the common components between two SAST tools. In contrast, the metamorphic testing approaches [29, 53] flag variants that violate predefined metamorphic relations as potentially faulty, while they only focus on a narrow range of program transformations. Random testing approach [8] generates and selects program variants in a purely random manner, leading to inefficient exploration of the search space. Program generation approach [15] relies on SMT solvers to verify safety properties and construct valid benchmarks, but are often highly computationally intensive. Despite their proven effectiveness, these conventional approaches suffer from several common key limitations.

C1: Inability to Support Multi-Language SAST Tools. Existing research efforts are predominantly designed for single programming languages. For instance, Statifier [53] and SAScope [55] target Java, while FuzzSA [19] focuses on C++. Although the underlying methodologies of these approaches exhibit a degree of generalizability, their direct application to other languages remains challenging. Furthermore, inherent linguistic differences can cause the test oracles and program transformation strategies, which are effective for one language, to fail when applied to another.

C2: Limitation of Variant Diversity by a Predefined Transformation Set. Traditional research on testing SAST tools via variant generation relies primarily on predefined semantics-preserving transformations [29, 53, 55]. This results in limited variant diversity, thereby constraining fault detection effectiveness. As a consequence, such testing often fails to emulate complex real-world scenarios where code behavior is unintentionally modified, leaving gaps in assessing the robustness and correctness of SAST tools. Moreover, as programming languages evolve with new features and paradigms, SAST tools frequently struggle to keep pace. For example, Java Records, introduced in 2021, has revealed shortcomings in tools like SonarQube, causing issues such as those reported in [2, 17]. These problems stem from incomplete or inaccurate handling of new syntax and semantics. Similarly, support for advanced language concepts (such as the ownership system and unsafe blocks in Rust) often remains limited, further restricting analysis capabilities.

C3: Lack of an Effective Approach for Filtering Invalid Variants. Given the inherent limitations of testing approaches, for example, an LLM-based approach may suffer from hallucinations [49] that produce invalid variants failing to satisfy the constraints specified in the prompt. While identifying faults with clear oracles (e.g., runtime crashes) is straightforward, prior studies [29, 54] indicate that faults in SAST tools encompass not only crashes but also functional issues such as false positives or negatives resulting from flawed code logic. Existing research work [45, 48] has primarily focused on detecting runtime crashes, which can be directly observed during execution. In contrast, our work also aims to uncover logic faults, necessitating a validation mechanism to assess whether the generated variants adhere to the constraints.

Our Approach. To tackle these challenges, we propose LLM4SAST, a novel metamorphic testing framework. It is designed to be universal, capable of testing SAST tools that support multiple programming languages and their evolving features. Our approach represents a fundamental departure from conventional SAST testing techniques like Statifier [53] and SAST-MT [29]. These existing methods employ a limited set of pattern-based program transformations that, Manuscript submitted to ACM

Combining LLM and Dynamic Analysis for Universal Testing of Static Application Security Testing Tools

3

resulting in a lack of program diversity, and only target on a single programming language. The core innovation of our work lies in harnessing large language models as a program transformation engine. LLMs are uniquely suited for this role due to their extensive pre-training on diverse code corpora spanning multiple programming languages and formal systems. This training endows them with an intrinsic understanding of complex language semantics and specialized features. LLM4SAST capitalizes on this capability by employing an LLM as a universal generation and transformation engine, enabling it to produce semantically-rich, language-aware test inputs that far surpass the diversity achievable by traditional methods.

The input to LLM4SAST consists of three key components: (1) the SAST tool S to be tested by LLM4SAST, (2) an input programs for S, and (3) the documentation of S that contains vulnerability descriptions. Using these inputs, LLM4SAST first invokes S to analyze the input programs and generate the corresponding reports. It then constructs input prompts based on predefined templates. These carefully engineered prompts enable the generation of semantics-diverse program variants specifically designed to expose potential faults in SAST tools. To mitigate issues caused by inherent drawbacks of LLMs, particularly the problem of hallucination [20], which leads to non-compliant program variants, we developed a dynamic-feedback-driven variant selection technique. By combining runtime status and dynamic analysis results of program variants during test execution, this technique efficiently eliminates invalid variants. Subsequently, the valid LLM-generated variants are submitted to the target SAST tools. Their analysis reports are then validated using a set of three test oracles to identify potential faults of SAST tools.

LLM4SAST is designed to overcome the limitations of traditional testing approaches outlined earlier. In contrast to existing methods, which are often tied to a specific language version or tool (C1), LLM4SAST can readily adapt to new language features. This adaptability can be achieved with minimal effort; for instance, simply providing the LLM with documentation or code examples of the new feature is sufficient to guide the generation of relevant test cases. Unlike traditional approaches that support only a narrow range of program transformations, leading to low diversity in program variants (C2), we propose a method utilizing three types of metamorphic relations to guide program transformations from multiple views. This approach is not limited to semantics-preserving transformations, thereby significantly increasing the semantic diversity of the program variants. Furthermore, to overcome the inherent limitation of LLMs generating invalid variants (C3), we propose a dynamic-feedback-driven selection heuristic. This heuristic integrates runtime status and dynamic analysis to filter out variants that fail to satisfy the constraints defined in the metamorphic relations.

We conducted a comprehensive evaluation of LLM4SAST on six SAST tools that support both Java and Rust programming languages. For each tool, we benchmarked our approach against existing testing techniques. In total, LLM4SAST can detect 66 unique faults in the tested SAST tools, with 32 of these confirmed or fixed by the respective developers as previously unknown. The results demonstrate that LLM4SAST identifies the highest number of faults across both languages, discovering 3.4 times as many faults as the existing approach while requiring only 39.8% of the variants. Overall, our work makes the following main contributions:

  • We propose LLM4SAST, to the best of our knowledge, the first LLM-driven automated testing framework for detecting faults in SAST tools. It leverages the code knowledge encoded in large language models to generate diverse program variants, incorporating a dynamic feedback mechanism to validate their correctness. Capitalizing on the multilingual nature of LLMs, LLM4SAST provides a universal testing solution applicable across multiple programming languages.

Huaien et al.

• We introduce novel test oracles powered by LLMs, which support not only diverse semantics-preserving transformations but also program repair and vulnerability injection. This approach significantly expands the semantic scope of generated variants beyond equivalence preservation, enabling the detection of deeper semantic faults. The evaluation results demonstrate that LLM4SAST achieves 3.4 times higher fault detection effectiveness compared with the state-of-the-art technique.

• We implemented LLM4SAST and conducted a large-scale evaluation on six mainstream open-source SAST tools for Java and Rust. The framework successfully detected 66 unique faults, of which 32 have been confirmed or fixed by developers following our reports. The results demonstrate the practical effectiveness and significant value of our approach. The experimental data and source code are available at: https://llm4sast.github.io/.

References (20)