Skip to main content
QUICK REVIEW

[Paper Review] Automated software vulnerability detection with machine learning

Jacob Harer, Louis Y. Kim|arXiv (Cornell University)|Feb 14, 2018
Software Engineering ResearchComputer Science18 references133 citations
TL;DR

A data-driven ML approach detects vulnerabilities in C/C++ functions using source-based and build-based features; the best model (TextCNN features fed into an extra-trees classifier) achieves PR AUC 0.49 and ROC AUC 0.87.

ABSTRACT

Thousands of security vulnerabilities are discovered in production software each year, either reported publicly to the Common Vulnerabilities and Exposures database or discovered internally in proprietary code. Vulnerabilities often manifest themselves in subtle ways that are not obvious to code reviewers or the developers themselves. With the wealth of open source code available for analysis, there is an opportunity to learn the patterns of bugs that can lead to security vulnerabilities directly from data. In this paper, we present a data-driven approach to vulnerability detection using machine learning, specifically applied to C and C++ programs. We first compile a large dataset of hundreds of thousands of open-source functions labeled with the outputs of a static analyzer. We then compare methods applied directly to source code with methods applied to artifacts extracted from the build process, finding that source-based models perform better. We also compare the application of deep neural network models with more traditional models such as random forests and find the best performance comes from combining features learned by deep models with tree-based models. Ultimately, our highest performing model achieves an area under the precision-recall curve of 0.49 and an area under the ROC curve of 0.87.

Motivation & Objective

  • Motivate and address the need for scalable vulnerability detection in software.
  • Leverage large open-source code datasets labeled by static analyzers to train ML models.
  • Compare source-based versus build-based features for vulnerability detection.
  • Evaluate traditional and deep learning models and explore model fusion for improved performance.

Proposed method

  • Construct two feature pipelines: (1) build-based features from CFG, use-def, and op-vec extracted during compilation; (2) source-based token features using a custom C/C++ lexer, bag-of-words, and word2vec embeddings.
  • Train multiple classifiers on function-level labels derived from Clang static analyzer outputs, treating buggy vs. good as ground truth.
  • Evaluate three source-based models: Extra Trees with Bag-of-Words (BoW) features, TextCNN with word2vec initialization, and TextCNN features fed into Extra Trees; also compare build-based Random Forest on fixed-size build feature vectors.
  • Investigate a combined model by concatenating build-based features with source-based BoW features.
  • Use two datasets (Debian and GitHub) and perform strict duplicate removal to ensure evaluation validity.

Experimental results

Research questions

  • RQ1Can vulnerability detection be effectively learned from source code patterns alone, or do build-derived features provide complementary information?
  • RQ2Do deep learning representations (word2vec, TextCNN) outperform traditional models for this task, and does model fusion improve performance?
  • RQ3How do source-based and build-based approaches compare across datasets with different characteristics (Debian vs. GitHub)?

Key findings

  • Source-based models outperform build-based models in ROC AUC across datasets.
  • Best source-based model (TextCNN features into Extra Trees) achieves ROC AUC 0.87 and PR AUC 0.49 on the combined Debian+Github dataset.
  • BoW+ET achieves ROC AUC 0.85 and PR AUC 0.44 on the same dataset; word2vec+CNN achieves ROC AUC 0.87 and PR AUC 0.45; CNN feat.+ET achieves ROC AUC 0.87 and PR AUC 0.49.
  • On build-based detection, Debian yields ROC AUC 0.76 and PR AUC 0.21; Github yields ROC AUC 0.74 and PR AUC 0.22.
  • Combined models (build+source) generally outperform individual sources, e.g., on Github: Build 0.74/0.22, Source 0.81/0.29, Combined 0.82/0.32.

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.