Introduction
Open-source software (OSS) is the backbone of modern digital infrastructure. However, the security of these libraries often relies on developers' diligence in reporting vulnerabilities. A significant challenge arises when security vulnerabilities are patched "silently"—without being assigned a Common Vulnerabilities and Exposures (CVE) identifier or being publicly announced. Research indicates that nearly 70% of OSS vulnerabilities are patched before a CVE is published, leaving downstream users exposed. Identifying these patches manually is unfeasible due to the sheer volume of daily commits. This paper presents SPI (Security Patch Identifier), a deep learning system designed to automatically detect hidden security patches by analyzing both commit messages and code revisions.
Methodology: The SPI Framework
The SPI system utilizes an ensemble approach, combining insights from natural language (commit messages) and programming logic (code changes). The architecture consists of two primary neural networks:
- SPI-CM (Commit Message Model): This model processes the natural language descriptions of commits. It employs Word2vec for word embeddings, followed by a Long Short-Term Memory (LSTM) network to capture sequential context and a Convolutional Neural Network (CNN) to extract high-level features.
- SPI-CR (Code Revision Model): Recognizing that commit messages can be vague (e.g., "fixed bug"), SPI-CR analyzes the code "diff." It uses a statement-level LSTM to process added (additive) and removed (subtractive) code fragments separately. CNN layers then compare these states to identify structural patterns typical of security fixes, such as bounds checks or null-pointer validations.
The outputs of these two models are ensembled via a weighted average to produce a final binary classification: Security Patch or Non-Security Patch.
Data Collection and Labeling
To train and evaluate SPI, the authors curated a large-scale dataset from major C-language projects, including Linux, FFmpeg, Qemu, and Wireshark.
The data collection process involved:
- Experimental Dataset: 344,519 commits were initially crawled.
- Filtering: Keyword-based filtering narrowed the pool to 40,523 potential security commits.
- Manual Labeling: Security researchers spent 600 man-hours manually labeling these commits to establish a ground truth.
- Industrial Validation: The model was also tested on a production dataset of 298,917 commits from 410 different C libraries provided by an industry partner.
Key Results and Insights
SPI demonstrated superior performance compared to traditional rule-based and machine learning baselines:
- Accuracy: The ensemble model achieved an 87.93% F1-score and 86.24% precision on the experimental dataset.
- Code Revision Impact: SPI-CR significantly improved F1-scores by approximately 59% over baseline methods, proving that code-level analysis is critical when commit messages are uninformative.
- Real-world Scalability: In a production environment, SPI successfully filtered out over 50% of commits as non-security related with 93.63% accuracy, effectively halving the manual workload for security analysts.
The study also revealed that SPI is particularly effective for shorter patches (under 50 tokens), which aligns with the nature of many security fixes—small, targeted modifications to prevent specific exploits.
Conclusion and Future Work
SPI provides a scalable solution for identifying silent security patches, bridging the gap between patch release and public disclosure. While highly effective for C-language projects, future work aims to extend the system to other languages like Java and Python. Additionally, incorporating Graph Neural Networks (GNNs) could further enhance the model's understanding of complex code structures beyond simple token sequences.
Summary updated