LLM-Assisted Static Analysis for Detecting Security Vulnerabilities

Ziyang Li, Saikat Dutta, Mayur Naik · DOI

Introduction

Static taint analysis remains the industry standard for identifying security vulnerabilities in large-scale software repositories. By tracking the flow of untrusted data from an external "source" to a sensitive "sink," these tools can preemptively catch critical bugs like SQL injection or path traversal. However, traditional static analysis suffers from two primary limitations: the Specification Gap and the Precision Gap.

The Specification Gap arises because tools like GitHub’s CodeQL rely on manually curated libraries of known sources and sinks. When a project utilizes niche or internal third-party libraries, the analysis becomes blind to potential vulnerabilities. Conversely, the Precision Gap refers to the high rate of false positives; static tools often lack the semantic context to distinguish between a technically reachable path and a logically dangerous one. IRIS addresses these challenges by integrating Large Language Models (LLMs) into a neuro-symbolic framework, combining deep code understanding with rigorous data-flow reasoning.

High-level overview of the IRIS framework for vulnerability detection.

The IRIS Framework: A Neuro-Symbolic Pipeline

IRIS operates through a four-stage pipeline that leverages the strengths of both symbolic static analysis and neural language models.

1. Candidate Extraction and Specification Inference

The process begins with a static pass to identify all external API calls and internal function parameters that could serve as potential sources or sinks. These candidates are then fed to an LLM (such as GPT-4), which uses its extensive knowledge of library documentation and common programming patterns to label them. This "on-the-fly" rule generation effectively closes the Specification Gap, allowing IRIS to adapt to any codebase without manual configuration.

2. Static Taint Analysis

The LLM-generated labels are converted into formal CodeQL queries. CodeQL then performs the computationally intensive task of tracing data-flow paths across the entire repository. This stage utilizes the symbolic engine's strength in "whole-repository" reasoning, which exceeds the context window limitations of current LLMs.

3. Contextual Filtering

To bridge the Precision Gap, IRIS employs a final "sanity check." For every potential vulnerable path identified by CodeQL, the relevant code snippets are sent back to the LLM. The model performs a contextual analysis to determine if the path represents a genuine threat or a false alarm caused by project-specific sanitization or logical constraints.

Detailed architectural pipeline of IRIS, from candidate extraction to contextual vulnerability analysis.

Evaluation and Results

The effectiveness of IRIS was evaluated using CWE-Bench-Java, a novel benchmark comprising 120 manually validated real-world vulnerabilities across four major classes: Path Traversal (CWE-22), OS Command Injection (CWE-78), Cross-Site Scripting (CWE-79), and Code Injection (CWE-94). These vulnerabilities were sourced from complex projects averaging 300,000 lines of code.

The results demonstrate a significant leap in detection capabilities:

  • Recall Improvement: IRIS (using GPT-4) detected 55 vulnerabilities, a 103.7% improvement over the baseline CodeQL, which found only 27.
  • Precision and F1 Score: Despite the aggressive search for new sinks, IRIS maintained a lower False Discovery Rate (FDR) than the baseline, leading to a 0.1 improvement in the average F1 score.
  • Zero-Day Discoveries: The framework successfully identified four previously unknown vulnerabilities in popular open-source projects, such as Alluxio, which had been missed by traditional tools.

Discussion and Future Work

The synergy between LLMs and static analysis proves that "local intuition" and "global mapping" are complementary. While IRIS significantly advances the state-of-the-art, it faces challenges with complex dataflows involving side effects (e.g., temporary file writes) that are difficult for current static engines to track. Additionally, the use of LLMs introduces higher latency and operational costs compared to traditional scans. Future research will focus on extending support to other languages like C/C++ and Python, and optimizing the pipeline to reduce computational overhead.

Conclusion

IRIS represents a paradigm shift in automated security auditing. By automating the creation of taint specifications and providing semantic filtering of results, it nearly doubles the efficacy of traditional static analysis. This neuro-symbolic approach provides a scalable path toward more secure software ecosystems, capable of keeping pace with the rapid evolution of modern codebases.

Summary updated

BibTeX
@inproceedings{li2025llm,
  author = {Ziyang Li and Saikat Dutta and Mayur Naik},
  title = {{LLM-Assisted Static Analysis for Detecting Security Vulnerabilities}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=9LdJDU7E91},
}
Figure