Effective Source Code Vectorization for Vulnerability Detection Using Deep Learning and Attention Mechanism

29 Pages Posted: 29 Jan 2023

See all articles by Erzhou Zhu

Erzhou Zhu

Anhui University

Jiaqi Chang

Anhui University

Siyuan Luo

Anhui University

Zhujuan Ma

affiliation not provided to SSRN

Abstract

With the increasing availability of computational power, deep learning methods have been widely used for detecting software vulnerabilities in recent years. In contrast to traditional machine learning technology, deep learning methods have the merits of low computational overhead and high vulnerability detection accuracy, and they do not depend on expert knowledge to extract vulnerability features. However, the performance of many existing deep vulnerability detection methods is degraded by inadequate information about the syntax and semantics of source code. This paper proposes Vulnerability Detection based on Deep learning and Attention mechanisms (VDDA), an effective software vulnerability detection model based on deep learning and an attention mechanism. In VDDA, the bidirectional long short-term memory (BLSTM) deep model is used to alleviate the need for the feature engineering of traditional machine learning techniques. With the Joern analysis tool, the source code is converted to code property graphs (CPG) to retain the affluent syntax and semantic information. Several improvements, including depth-first traversal-based CPG optimization, three-direction code slicing, slice organization with code blocks, and the separation of function names from variable names in code symbolization, were made to effectively convert source code into vectors that could be taken as the only input to the underlying deep learning model. Meanwhile, because different parts of the vector play different roles in vulnerability detection, the attention mechanism was integrated with BLSTM to further improve vulnerability detection performance. The experimental results on two datasets of different scales demonstrated that the proposed VDDA outperforms many existing methods in vulnerability detection.

Keywords: Software security, Vulnerability detection, Deep Learning, Attention mechanism

Suggested Citation

Zhu, Erzhou and Chang, Jiaqi and Luo, Siyuan and Ma, Zhujuan, Effective Source Code Vectorization for Vulnerability Detection Using Deep Learning and Attention Mechanism. Available at SSRN: https://ssrn.com/abstract=4341595 or http://dx.doi.org/10.2139/ssrn.4341595

Erzhou Zhu (Contact Author)

Anhui University ( email )

China

Jiaqi Chang

Anhui University ( email )

China

Siyuan Luo

Anhui University ( email )

China

Zhujuan Ma

affiliation not provided to SSRN ( email )

No Address Available

Do you have a job opening that you would like to promote on SSRN?

Paper statistics

Downloads
128
Abstract Views
418
Rank
479,772
PlumX Metrics