Abstract
Vulnerability patch localization is a critical task in software supply chain security, aimed at identifying the specific code commits that address known security flaws. This paper presents a novel two-stage framework that leverages Large Language Models (LLMs) and version-driven filtering to overcome the challenges of search space explosion and semantic gaps. Our approach achieves 83.6% accuracy on a curated dataset of 750 real-world vulnerabilities, significantly outperforming existing state-of-the-art tools.
Introduction
When a security vulnerability is discovered, a dangerous "time lag" often exists between its discovery and the public disclosure of the fix. Many vulnerabilities are "silently fixed"—the code is patched in a repository, but the specific commit is not linked in public databases like the National Vulnerability Database (NVD). For security researchers and system administrators, finding the correct patch commit among thousands of daily code changes is a significant challenge. Existing automated tools struggle due to the search space explosion in large projects, the semantic gap between high-level bug descriptions and low-level code changes, and the inherent delay in crawler-based advisory tools.
Methodology
The researchers propose a two-stage solution that leverages the reasoning power of LLMs rather than complex, custom-built neural architectures.
Stage 1: Version-Driven Candidate Filtering
Instead of examining every commit, the system mines CVE descriptions to identify affected software versions. It employs Multi-branch Cross-filtering: if a similar commit appears across multiple maintenance branches (e.g., backported to several versions), it is flagged as a high-probability patch candidate. This drastically reduces the search space from thousands of commits to a manageable handful.
Stage 2: LLM-Based Identification & Voting
The system feeds the candidate commits and the vulnerability description into an LLM (specifically GPT-4o-mini). To ensure reliability, it uses:
- Multi-round Dialogue Voting: The system runs the query multiple times (10+ rounds) and uses a majority vote to pick the final answer, combating LLM hallucinations.
- Chain-of-Thought (CoT): Prompts are designed to make the model reason through code changes before deciding.
- Code Analysis: The Antlr4 parser extracts specific function bodies, providing the LLM with clean, structured context rather than noisy diff files.
Datasets and Experimental Setup
The researchers curated a new, comprehensive dataset to test their approach, consisting of 750 real-world vulnerabilities spanning 2020 to 2024. Data was sourced from NVD, VERA, and SNYK databases.
To test generalization, the study included a "Future Data" test set of 25 CVEs from 2024 released after the LLM's training cutoff. This ensures the model had not encountered these specific patches during its pre-training phase.
Key Results
The proposed method demonstrated a significant improvement over current state-of-the-art baselines:
- Accuracy: Reached 83.6%, compared to 62.9% for the best existing tool (Tracer).
- F1-Score: Improved to 0.66, a 26% relative increase over baselines.
- Generalization: On the 2024 vulnerabilities, the model maintained an 88% accuracy rate.
- Efficiency: The authors estimate that system admins would only need to manually verify approximately 16% of cases compared to previous methods.
Discussion and Insights
The study revealed that the search space is the primary bottleneck; filtering is the most critical part of the pipeline. Furthermore, the researchers found that domain-specific pre-trained code knowledge is more valuable than complex architectural designs. While crawler-based tools are accurate, they suffer from a "timeliness" problem, often lagging behind actual code fixes by over 100 days.
Conclusion
This research highlights the potential of LLMs in automating security-critical tasks like patch localization. While powerful, challenges remain regarding the cost and latency of LLM inference and the ambiguity of some CVE descriptions. Future work will explore "Web Information Fusion," where LLMs act as autonomous agents to gather clues from developer discussions and issue trackers to supplement code analysis.
Summary updated