[Paper Review] Learning to Catch Security Patches
This paper proposes a co-training approach that leverages commit logs and code change features to automatically identify security patches in software repositories, achieving 95% precision and 88% recall—significantly outperforming state-of-the-art methods and successfully detecting previously unlabeled silent security fixes.
Timely patching is paramount to safeguard users and maintainers against dire consequences of malicious attacks. In practice, patching is prioritized following the nature of the code change that is committed in the code repository. When such a change is labeled as being security-relevant, i.e., as fixing a vulnerability, maintainers rapidly spread the change and users are notified about the need to update to a new version of the library or of the application. Unfortunately, oftentimes, some security-relevant changes go unnoticed as they represent silent fixes of vulnerabilities. In this paper, we propose a Co-Training-based approach to catch security patches as part of an automatic monitoring service of code repositories. Leveraging different classes of features, we empirically show that such automation is feasible and can yield a precision of over 90% in identifying security patches, with an unprecedented recall of over 80%. Beyond such a benchmarking with ground truth data which demonstrates an improvement over the state-of-the-art, we confirmed that our approach can help catch security patches that were not reported as such.
Motivation & Objective
- To address the challenge of identifying security-relevant code changes that are silently fixed without CVE or advisory disclosure.
- To automate the detection of security patches using only commit-level information available at time of contribution.
- To improve upon existing methods by leveraging semi-supervised learning with co-training on multiple feature views.
- To demonstrate that the approach can uncover previously unlabeled security patches through empirical validation.
Proposed method
- The method uses two separate classifiers trained on distinct feature views: natural language features from commit logs and structural code change features (e.g., line changes, array index modifications).
- It applies co-training, a semi-supervised learning technique, where each classifier iteratively labels high-confidence unlabeled samples for the other, improving generalization.
- Features include commit message keywords, code change metrics (e.g., number of lines modified), and vulnerability-indicative patterns (e.g., buffer overflows, memory leaks).
- The approach is designed to work under real-world constraints where labels are scarce and only commit-time data is available.
- It avoids project-specific features (e.g., author, file path) to ensure generalizability across repositories.
- The model is evaluated using ground truth labels and validated via manual auditing with expert reviewers.
Experimental results
Research questions
- RQ1Can a co-training approach effectively identify security patches using only commit-level metadata and code changes?
- RQ2How well does the model perform compared to state-of-the-art methods in terms of precision and recall?
- RQ3Can the model detect security patches that were not previously labeled as such (i.e., silent fixes)?
- RQ4Do high-information-gain features provide actionable hints for manual review of flagged patches?
- RQ5How robust is the model to label scarcity and class imbalance in real-world software repositories?
Key findings
- The co-training model achieved 95% precision and 88% recall in identifying security patches, significantly outperforming existing approaches.
- The method successfully detected 10 previously unlabeled security patches that were not listed in public vulnerability databases.
- Manual auditing confirmed that 55% of the top-ranked flagged patches were considered useful by expert reviewers, indicating strong practical utility.
- Features with high information gain (e.g., memory leak fixes, array index changes) provided meaningful signals for manual review.
- The model demonstrated strong performance even with limited labeled data, highlighting the effectiveness of co-training in low-resource settings.
- The approach generalizes across projects, as it excludes project-specific features and relies on universal code and text patterns.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.