NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

SySeVR: A Framework for Using Deep Learning to Detect Software Vulnerabilities

Zhen Li, Deqing Zou, Shouhuai Xu, Hai Jin, Yawei Zhu, Zhaoxuan Chen · DOI

TL;DR

This paper introduces SySeVR, a novel framework that leverages deep learning to detect software vulnerabilities in C/C++ source code. By representing code snippets as vectors that capture both syntax and semantics, SySeVR significantly improves vulnerability detection accuracy and can even uncover previously unknown vulnerabilities.

What Problem Does This Paper Address?

Software vulnerabilities are a persistent threat, leading to countless cyberattacks. While static analysis methods exist, they often require manual feature engineering, are prone to errors, or struggle with vulnerabilities not related to code cloning. Deep learning offers a promising avenue by automating feature extraction, but a "domain gap" exists: deep learning models excel with natural vector representations (like images), while source code lacks this inherent structure. This paper aims to bridge this gap by developing a systematic way to represent code for deep learning-based vulnerability detection, addressing the need for more effective and automated solutions.

Methods

The core of SySeVR lies in its three-step process:

  1. Syntax-based Vulnerability Candidates (SyVCs): The framework first identifies potential vulnerability locations by extracting "SyVCs." These are code elements that match predefined vulnerability syntax characteristics. The authors leverage rules from a commercial tool (Checkmarx) to define four categories of syntax characteristics: Function Calls (FC), Array Usage (AU), Pointer Usage (PU), and Arithmetic Expressions (AE).
  2. Semantics-based Vulnerability Candidates (SeVCs): To enrich the representation, SyVCs are expanded into "SeVCs." This involves using program slicing techniques (based on data and control dependencies) to include semantically related statements. This step aims to capture the context and flow of information around a potential vulnerability.
  3. Vector Representations: Finally, each SeVC is encoded into a fixed-length vector. This is achieved by first transforming the SeVC into a symbolic representation (replacing variable and function names with generic symbols) and then using word2vec to create dense vector embeddings for each symbol. These vectors are then padded or truncated to a uniform length for input into deep learning models.

Datasets

The authors created a comprehensive vulnerability dataset by combining:

  • National Vulnerability Database (NVD): Containing vulnerabilities in open-source C/C++ products.
  • Software Assurance Reference Dataset (SARD): Providing programs categorized as "good" (no vulnerabilities), "bad" (vulnerable), or "mixed" (vulnerable with patched versions available).

This dataset comprises 15,591 programs with 126 unique vulnerability types (CWE IDs). The authors also note that their previously published dataset for VulDeePecker was insufficient for this work due to its limited scope (only 2 vulnerability types).

Key Insights and Ideas

  • Bridging the Domain Gap: The central idea is to transform code into a vector representation that deep learning models can effectively process, capturing both syntactic and semantic nuances of vulnerabilities.
  • SyVCs as Starting Points: Using predefined syntax characteristics (derived from expert rules) provides an efficient way to identify initial candidate locations for vulnerabilities.
  • SeVCs for Context: Expanding SyVCs to SeVCs by incorporating data and control dependencies significantly enhances the semantic information available to the models, leading to better detection.
  • Bidirectional RNNs Excel: Models like Bidirectional Gated Recurrent Units (BGRUs) and Bidirectional Long Short-Term Memory (BLSTMs) demonstrate superior performance due to their ability to process information in both forward and backward directions, capturing contextual dependencies.
  • Explainability through Frequency: The effectiveness of deep learning models can be partially explained by analyzing the frequency of certain syntax elements (tokens) in vulnerable vs. non-vulnerable code, offering insights into potential false positives and negatives.

Key Results

  • Improved Detection: SySeVR-enabled BLSTM achieved a 5.0% lower False Negative Rate (FNR) and 3.4% lower False Positive Rate (FPR) compared to VulDeePecker for FC-kind vulnerabilities.
  • Model Performance: Bidirectional RNNs (BGRU, BLSTM) outperformed other models (CNN, DBN, shallow models) in detecting vulnerabilities, achieving high F1-scores (e.g., BGRU with 85.8%).
  • Impact of Control Dependency: Incorporating control dependency into SeVCs reduced FNR by 30.4% and improved F1-measure by 24.0% on average.
  • New Vulnerability Discovery: The SySeVR-BGRU model detected 15 vulnerabilities in real-world software products that were not previously reported in NVD. Of these, 7 were unknown and reported to vendors, and 8 were "silently" patched in newer versions.
  • State-of-the-Art Performance: SySeVR-BGRU significantly outperformed existing state-of-the-art tools like Flawfinder, RATS, and Checkmarx, achieving an F1-score of 92.6% and MCC of 90.5%.

Limitations and Future Work

  • Language Specificity: The current framework is designed for C/C++ and may require adaptation for other languages.
  • Syntax Characteristic Coverage: The four defined syntax characteristics cover 93.6% of vulnerable programs in SARD, but this coverage is not exhaustive. Future work should identify more comprehensive vulnerability syntax characteristics.
  • Algorithm Refinement: Algorithms for generating SyVCs and SeVCs could be further improved to capture more syntactic/semantic information.
  • Model Specialization: Investigating whether specialized models for different vulnerability types are more effective than a single model for all types is suggested.
  • Precision of Detection: The current detection is at the "slice level"; future work could aim for more precise line-level vulnerability pinpointing.
  • Ground-Truth Labeling: While manual checks were performed on a subset of samples, more robust automatic labeling methods could be explored.
  • Code Duplication Impact: The influence of code duplication on SySeVR-enabled models warrants further investigation.

Summary updated

BibTeX
@article{li2018sysevr,
  author = {Zhen Li and Deqing Zou and Shouhuai Xu and Hai Jin and Yawei Zhu and Zhaoxuan Chen},
  title = {{SySeVR: A Framework for Using Deep Learning to Detect Software Vulnerabilities}},
  journal = {IEEE Trans. Dependable Secur. Comput.},
  year = {2018},
  doi = {10.1109/tdsc.2021.3051525},
}
Figure