Source Code Vulnerability Detection: Combining Code Language Models and Code Property Graphs
Authors:
- Ruitong LiuRLRuitong Liu
- Yanbin WangYWYanbin Wang
- Haitao XuHXHaitao Xu
- Bin LiuBLBin Liu
- Jianguo SunJSJianguo Sun
- Zhenhao GuoZGZhenhao Guo
- Wenrui MaWMWenrui Ma
Preprint
Abstract
Currently, deep learning successfully applies to code vulnerability detection by learning from code sequences or property graphs. However, sequence-based methods often overlook essential code attributes such as syntax, control flow, and data dependencies, whereas graph-based approaches might underestimate the semantics of code and face challenges in capturing long-distance contextual information. To address this gap, we propose Vul-LMGNN, a unified model that combines pre-trained code language models with code property graphs for code vulnerability detection. Vul-LMGNN constructs a code property graph that integrates various code attributes (including syntax, flow control, and data dependencies) into a unified graph structure, thereafter leveraging pre-trained code model to extract local semantic features as node embeddings in the code property graph. Furthermore, to effectively retain dependency information among various attributes, we introduce a gated code Graph Neural Network (GNN). By jointly training the code language model and the gated code GNN modules in Vul-LMGNN, our proposed method efficiently leverages the strengths of both mechanisms. Finally, we utilize a pre-trained CodeBERT as an auxiliary classifier, with the final detection results derived by learning the linear interpolation of Vul-LMGNN and CodeBERT. The proposed method, evaluated across four real-world vulnerability datasets, demonstrated superior performance compared to six state-of-the-art approaches. Our source code could be accessed via the link: https://github.com/Vul-LMGNN/vul-LMGGNN.Keywords
All Related Versions
- Version 1, 2024-04-23, ArXiv
- Version 2, 2025-03-21, ArXiv
- Published version: Information Fusion, 115.
This publication has 19 references indexed in Scilit:
- An automatic vulnerability classification framework based on BiGRU-TextCNNProcedia Computer Science, 2023
- An empirical study of text-based machine learning models for vulnerability detectionEmpirical Software Engineering, 2023
- CSGVD: A deep learning approach combining sequence and graph embedding for source code vulnerability detectionJournal of Systems and Software, 2023
- Deep Learning Based Vulnerability Detection: Are We There Yet?IEEE Transactions on Software Engineering, 2021
- SySeVR: A Framework for Using Deep Learning to Detect Software VulnerabilitiesIEEE Transactions on Dependable and Secure Computing, 2021
- Combining Graph-Based Learning With Automated Data Collection for Code Vulnerability DetectionIEEE Transactions on Information Forensics and Security, 2020
- Software Vulnerability Discovery via Learning Multi-Domain Knowledge BasesIEEE Transactions on Dependable and Secure Computing, 2019
- Improving text classification with weighted word embeddings via a multi-channel TextCNN modelNeurocomputing, 2019
- μVulDeePecker: A Deep Learning-Based System for Multiclass Vulnerability DetectionIEEE Transactions on Dependable and Secure Computing, 2019
- Modeling and Discovering Vulnerabilities with Code Property Graphs2014