D2A: A Dataset Built for AI-Based Vulnerability Detection Methods Using Differential Analysis

Yunhui Zheng, Saurabh Pujar, Burn L. Lewis, Luca Buratti, Edward A. Epstein, Bo Yang, Jim Laredo, Alessandro Morari, Zhong Su

Introduction

Static analysis tools are indispensable for identifying security vulnerabilities in large-scale software systems. However, these tools are notoriously "noisy," often generating a high volume of false positives. This creates a significant burden for developers who must manually verify each report to find genuine bugs. Machine Learning (ML) offers a promising path toward automating this verification process, but the effectiveness of ML models is strictly bounded by the quality and scale of available training data. Existing datasets often suffer from being synthetic, too small, or lacking the inter-procedural context (traces) necessary to understand how complex vulnerabilities actually trigger.

The D2A Pipeline

To address these data quality issues, the authors developed the D2A (Differential Analysis) pipeline. This system automates the generation of high-quality labels by leveraging the version history of open-source projects.

The D2A pipeline for automated vulnerability labeling and dataset generation.

The process begins with Commit Message Analysis (CMA), where an NLP-based classifier identifies commits likely to be bug fixes. The system then performs Differential Static Analysis, running a static analyzer (Facebook’s Infer) on the code versions immediately before and after the identified fix. The Auto-Labeler assigns a "Positive" label if a bug report disappears in the "after" version and a "Negative" label if it persists. Finally, the system extracts the full inter-procedural trace and the specific code snippets involved, preserving the logical context of the vulnerability.

Dataset Composition and Comparison

The resulting D2A Dataset is one of the largest of its kind, featuring 1,295,623 unique auto-labeled examples and 18,653 "after-fix" examples. The data is sourced from six prominent open-source C/C++ projects: OpenSSL, FFmpeg, httpd, NGINX, libtiff, and libav.

Comparison of D2A with existing vulnerability detection datasets across key criteria.

When compared to existing benchmarks like Juliet or Devign, D2A stands out for its combination of real-world code, massive scale, and the inclusion of bug traces and codebase traceability. It is specifically designed to provide the "counter-factual" evidence (before vs. after fix) that helps models focus on the specific logic that makes code secure versus vulnerable.

Bridging the Ground Truth Gap

A critical contribution of D2A is its ability to improve the "signal-to-noise" ratio in training data. In a manual audit of OpenSSL reports, the authors found that only 7.8% of the static analyzer's raw reports represented actual bugs. By applying differential analysis, the D2A auto-labeler increased the true positive density in the resulting dataset to 53%. While not perfect, this represents a massive leap in data quality for training supervised models compared to raw tool output.

Experimental Results

The researchers evaluated the utility of D2A by building a "False Positive Reduction" classifier. Using an ensemble of models, they achieved a False Positive Reduction Rate (FPRR) of 70-80% across most projects. This demonstrates that models trained on D2A can effectively prioritize static analysis reports, significantly reducing manual auditing effort. Analysis of feature importance revealed that the "line number" of the error and the "length of the bug report" were strong predictors of whether an issue was a true positive, suggesting that deeper, more complex code paths are more prone to tool-induced noise.

Limitations and Future Work

Despite its scale, D2A has limitations. The 53% true positive rate implies that nearly half of the "positive" labels may still be noise, often due to non-deterministic behavior in static analyzers where a report might disappear even if the bug wasn't fixed. Additionally, the dataset is currently limited to C/C++ and is dependent on the specific bug types detectable by the Infer tool. Future work involves applying D2A to more advanced neural architectures, such as Graph Neural Networks, to better utilize the complex code traces provided.

Summary updated

BibTeX
@inproceedings{zheng2021d,
  author = {Yunhui Zheng and Saurabh Pujar and Burn L. Lewis and Luca Buratti and Edward A. Epstein and Bo Yang and Jim Laredo and Alessandro Morari and Zhong Su},
  title = {{D2A: A Dataset Built for AI-Based Vulnerability Detection Methods Using Differential Analysis}},
  booktitle = {ICSE (SEIP)},
  year = {2021},
  url = {https://openreview.net/forum?id=3fUMikJgzX},
}
Figure