Table of Contents
Fetching ...

Multi-Agent Taint Specification Extraction for Vulnerability Detection

Jonah Ghebremichael, Saastha Vasan, Saad Ullah, Greg Tystahl, David Adei, Christopher Kruegel, Giovanni Vigna, William Enck, Alexandros Kapravelos

TL;DR

JavaScript vulnerability detection is hindered by dynamic language features and the scale of npm dependencies. SemTaint combines static program analysis with specialized LLM agents to extract taint specifications and repair interprocedural edges, producing enhanced inputs for CodeQL taint queries. The three agents Source/Sink, CallGraph (with TICR), and Flow Summary work iteratively to identify package specific sources and sinks, resolve unresolved calls on vulnerability paths, and validate third party flows. Evaluation on known vulnerabilities and open source packages shows significant improvements, including 106 previously undetectable vulnerabilities found (65.43% recall) and four new vulnerabilities discovered, demonstrating the practical value of LLM-augmented taint specification extraction for scalable SAST with dependencies.

Abstract

Static Application Security Testing (SAST) tools using taint analysis are widely viewed as providing higher-quality vulnerability detection results compared to traditional pattern-based approaches. However, performing static taint analysis for JavaScript poses two major challenges. First, JavaScript's dynamic features complicate data flow extraction required for taint tracking. Second, npm's large library ecosystem makes it difficult to identify relevant sources/sinks and establish taint propagation across dependencies. In this paper, we present SemTaint, a multi-agent system that strategically combines the semantic understanding of Large Language Models (LLMs) with traditional static program analysis to extract taint specifications, including sources, sinks, call edges, and library flow summaries tailored to each package. Conceptually, SemTaint uses static program analysis to calculate a call graph and defers to an LLM to resolve call edges that cannot be resolved statically. Further, it uses the LLM to classify sources and sinks for a given CWE. The resulting taint specification is then provided to a SAST tool, which performs vulnerability analysis. We integrate SemTaint with CodeQL, a state-of-the-art SAST tool, and demonstrate its effectiveness by detecting 106 of 162 vulnerabilities previously undetectable by CodeQL. Furthermore, we find 4 novel vulnerabilities in 4 popular npm packages. In doing so, we demonstrate that LLMs can practically enhance existing static program analysis algorithms, combining the strengths of both symbolic reasoning and semantic understanding for improved vulnerability detection.

Multi-Agent Taint Specification Extraction for Vulnerability Detection

TL;DR

JavaScript vulnerability detection is hindered by dynamic language features and the scale of npm dependencies. SemTaint combines static program analysis with specialized LLM agents to extract taint specifications and repair interprocedural edges, producing enhanced inputs for CodeQL taint queries. The three agents Source/Sink, CallGraph (with TICR), and Flow Summary work iteratively to identify package specific sources and sinks, resolve unresolved calls on vulnerability paths, and validate third party flows. Evaluation on known vulnerabilities and open source packages shows significant improvements, including 106 previously undetectable vulnerabilities found (65.43% recall) and four new vulnerabilities discovered, demonstrating the practical value of LLM-augmented taint specification extraction for scalable SAST with dependencies.

Abstract

Static Application Security Testing (SAST) tools using taint analysis are widely viewed as providing higher-quality vulnerability detection results compared to traditional pattern-based approaches. However, performing static taint analysis for JavaScript poses two major challenges. First, JavaScript's dynamic features complicate data flow extraction required for taint tracking. Second, npm's large library ecosystem makes it difficult to identify relevant sources/sinks and establish taint propagation across dependencies. In this paper, we present SemTaint, a multi-agent system that strategically combines the semantic understanding of Large Language Models (LLMs) with traditional static program analysis to extract taint specifications, including sources, sinks, call edges, and library flow summaries tailored to each package. Conceptually, SemTaint uses static program analysis to calculate a call graph and defers to an LLM to resolve call edges that cannot be resolved statically. Further, it uses the LLM to classify sources and sinks for a given CWE. The resulting taint specification is then provided to a SAST tool, which performs vulnerability analysis. We integrate SemTaint with CodeQL, a state-of-the-art SAST tool, and demonstrate its effectiveness by detecting 106 of 162 vulnerabilities previously undetectable by CodeQL. Furthermore, we find 4 novel vulnerabilities in 4 popular npm packages. In doing so, we demonstrate that LLMs can practically enhance existing static program analysis algorithms, combining the strengths of both symbolic reasoning and semantic understanding for improved vulnerability detection.
Paper Structure (39 sections, 20 equations, 10 figures, 5 tables)

This paper contains 39 sections, 20 equations, 10 figures, 5 tables.

Figures (10)

  • Figure 1: SemTaint System Design
  • Figure 2: Extended taint propagation rules.
  • Figure 3: Source/Sink Agent discovering XSS sources and sinks in mrk.js through iterative code exploration.
  • Figure 4: CallGraph Agent resolution of unresolved calls in mrk.js, illustrating iterative code exploration of a dynamic dispatch call in Listing \ref{['code:mrk_strat_pattern']}
  • Figure 5: Taint-flow graph illustrating TICR's demand-driven approach
  • ...and 5 more figures