TL;DR
Security advisories often lack crucial links to the code commits that fix the vulnerabilities they describe. This paper introduces VFCFinder, a tool that uses Natural Language Processing (NLP) and machine learning to automatically identify these "Vulnerability Fixing Commits" (VFCs) with high accuracy. VFCFinder significantly improves the ability to connect security advisories to their corresponding fixes, making it easier for developers to secure their software.
What Problem Does This Paper Address?
Software vulnerabilities are a major concern, and security advisories are the primary way to communicate them. However, a significant problem is that many advisories, particularly in open-source software, are missing direct links to the specific code commits that fix the vulnerability. This gap makes it difficult for developers to quickly find and apply the necessary patches, hindering efforts to secure the software supply chain. The authors highlight that 63% of GitHub Security Advisories (GHSA) lack these crucial patch links. Existing methods for finding these links are often limited by poorly documented commit messages or incomplete advisories, and prior research has sometimes used datasets that aren't representative of real-world software development.
Methods
VFCFinder employs a multi-stage approach:
- Advisory Information Extraction: It first extracts key details from security advisories, including the vulnerability summary, CWE type, source code repository, related CVE/GHSA identifiers, and fixed versions.
- Commit Window Determination: It defines a "commit window" by identifying the git tags for the fixed and prior versions of the software. All commits between these tags are considered potential VFCs.
- Feature Engineering: VFCFinder uses five key features to rank commits:
- VFC Probability: A fine-tuned CodeBERT model predicts the likelihood that a commit fixes a vulnerability.
- VFC Type: CodeBERT also classifies the type of vulnerability fixed, mapping to OWASP Top 10 categories.
- Semantic Similarity: SentenceTransformers are used to measure the similarity between the commit message and the advisory details.
- Commit Location: The position of the commit within the commit window is considered.
- CVE/GHSA ID: The presence of a CVE or GHSA identifier directly in the commit message is checked.
- Ranking Model: These features are fed into an XGBoost model to produce a ranked list of potential VFCs.
- Contiguous Data Sampling: A novel evaluation approach is introduced that divides training and testing sets based on commit lifecycles, simulating how a human would search for a VFC.
Datasets
- VFC Identification Dataset: Composed of 54,858 commits, including 9,143 vulnerability-fixing commits (VFCs) and 45,715 non-VFCs, sourced from NVD, OSV, and VulasDB. This dataset spans nine programming languages.
- VFC Types Dataset: Contains 7,847 VFCs labeled with OWASP Top 10 vulnerability types.
- GHSA Data: A dataset of 138,529 commits from 2,138 projects, used for training the final ranking model.
- VCMatch Dataset: Used for benchmarking against prior work (10 OSS projects).
The paper emphasizes the use of a "contiguous sampling" technique for evaluation, which differs from prior work's random sampling and aims to provide a more realistic assessment.
Key Insights and Ideas
- The "Commit Window" is Key: The observation that most VFCs occur between the reported fixed and prior versions of software is a strong heuristic that VFCFinder leverages.
- Simplicity Trumps Complexity: VFCFinder uses only five features, significantly fewer than prior state-of-the-art methods (e.g., VCMatch's 100 features), yet achieves superior or comparable performance. This suggests that a well-chosen, concise set of features can lead to better generalization.
- CodeBERT's Versatility: The fine-tuned CodeBERT model proves effective for both identifying if a commit is a VFC and classifying the type of vulnerability it addresses, demonstrating its power across multiple programming languages.
- Real-World Impact: The successful integration of over 300 VFCs into the GHSA database highlights the practical utility and immediate value of VFCFinder.
Key Results
- High Recall: VFCFinder achieves a 96.6% recall for finding the correct VFC within the Top-5 ranked commits and an 80.0% recall for the Top-1 ranked commit on its representative dataset.
- Outperforms Prior Work: VFCFinder demonstrates a 36 percentage point improvement in Top-1 recall compared to VCMatch on its own dataset.
- Generalization: The tool generalizes well across nine programming languages.
- Practical Contribution: Over 300 missing VFCs were successfully backfilled into the GHSA database, all of which were accepted.
- VFC Identification Accuracy: Achieves an 89.3% macro F1 score and 94.4% accuracy for VFC identification.
- VFC Type Identification Accuracy: Achieves 80.1% Top-1 accuracy and 98.6% Top-5 accuracy for vulnerability type classification.
Limitations and Future Work
- Noisy Labels: The authors acknowledge the potential for noisy labels in the ground truth data.
- Unseen VFC Types: VFCFinder cannot identify VFC types for categories it has not seen during training (e.g., "Vulnerable and Outdated Components" was absent in their training data).
- Missing Source Code Links: A significant portion of GHSA advisories lack source code links, which are a prerequisite for VFCFinder's analysis. The paper outlines a methodology to find these links, but it's not always successful.
- Future Work: The authors suggest exploring more sophisticated methods for obtaining missing source code links and expanding the training data to include more diverse VFC types. They also mention the potential for improving VFC type classification for less common OWASP categories.
Summary updated