Skip to main content
QUICK REVIEW

[Paper Review] A ground-truth dataset of real security patches

Sofia Reis, Rui Abreu|arXiv (Cornell University)|Oct 18, 2021
Web Application Security VulnerabilitiesComputer Science18 references7 citations
TL;DR

This paper presents a large-scale, ground-truth dataset of 8,057 real security-relevant commits—equivalent to 5,942 security patches—from 1,339 projects across 20 programming languages and 146 CWE types. By aggregating and enriching data from CVE Details, Secbench, Pontas et al., and Big-Vul, the authors provide natural language artifacts (commit messages, comments, summaries), code changes, metadata, and downloadable codebases, along with a 110k-commit negative set for machine learning, enabling research in vulnerability detection, patch analysis, and NLP for security.

ABSTRACT

Training machine learning approaches for vulnerability identification and producing reliable tools to assist developers in implementing quality software -- free of vulnerabilities -- is challenging due to the lack of large datasets and real data. Researchers have been looking at these issues and building datasets. However, these datasets usually miss natural language artifacts and programming language diversity. We scraped the entire CVE details database for GitHub references and augmented the data with 3 security-related datasets. We used the data to create a ground-truth dataset of natural language artifacts (such as commit messages, commits comments, and summaries), meta-data and code changes. Our dataset integrates a total of 8057 security-relevant commits -- the equivalent to 5942 security patches -- from 1339 different projects spanning 146 different types of vulnerabilities and 20 languages. A dataset of 110k non-security-related commits is also provided. Data and scripts are all available on GitHub. Data is stored in a .CSV file. Codebases can be downloaded using our scripts. Our dataset is a valuable asset to answer research questions on different topics such as the identification of security-relevant information using NLP models; software engineering and security best practices; and, vulnerability detection and patching; and, security program analysis.

Motivation & Objective

  • To address the lack of large-scale, real-world datasets for training and evaluating machine learning models in vulnerability detection and patching.
  • To overcome limitations in existing datasets, such as missing natural language artifacts, limited programming language diversity, and lack of codebase access.
  • To provide a unified, cleaned, and extended dataset of security-relevant commits with rich metadata, natural language content, and code changes.
  • To support research in software engineering best practices, security patch impact analysis, and automated vulnerability detection through a reproducible, open-source dataset.

Proposed method

  • Web scraping of the entire CVE Details database by year to extract CVE metadata, including GitHub commit references.
  • Augmentation with three external datasets: Secbench, Pontas et al., and Big-Vul, to enrich vulnerability and patch information.
  • Extraction of detailed commit metadata (message, author, date, comments, file changes, diffs, parent commits) from GitHub using the collected commit URLs.
  • Data cleaning and deduplication, including removal of duplicate entries and filtering out branches that were ahead of the patch version.
  • Classification of programming languages based on file extensions in each commit, with less than 5% failure rate.
  • Creation of a negative dataset of 110,161 non-security-related commits for use in supervised machine learning tasks.

Experimental results

Research questions

  • RQ1Can natural language artifacts (e.g., commit messages and comments) be reliably extracted and used to train models for identifying security-relevant commits?
  • RQ2How do security patches vary across different programming languages and vulnerability types (CWEs) in real-world open-source projects?
  • RQ3To what extent do developers follow software engineering and security best practices in their commit messages and code changes?
  • RQ4Can the proposed dataset improve the performance and generalization of machine learning models in vulnerability detection and patch generation?
  • RQ5What are the structural and linguistic characteristics of real-world security patches, and how do they differ from non-security commits?

Key findings

  • The dataset contains 8,057 security-relevant commits from 1,339 distinct projects, representing 5,942 unique security patches.
  • These commits span 146 different CWE types and 20 programming languages, significantly expanding the diversity of existing datasets.
  • The dataset includes comprehensive natural language artifacts—CVE summaries, commit messages, and developer comments—enabling NLP-based research.
  • Code changes and full codebases are available for download via provided scripts, supporting low-level program analysis.
  • A negative dataset of 110,161 non-security-related commits is provided to support supervised learning and model evaluation.
  • The dataset is publicly available on GitHub with full tooling for data access, extension, and reproducibility.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.