arrow
Return

Vulnerability Detection by Learning From Syntax-Based Execution Paths of Code

delete2023-08-01
delete15
PRE
AI
J
Junwei Zhang
刘
刘忠鑫 (Zhongxin Liu) *
X
Xing Hu
X
Xin Xia
S
Shanping Li
DOI:10.1109/TSE.2023.3286586delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Vulnerability detection is essential to protect software systems. Various approaches based on deep learning have been proposed to learn the pattern of vulnerabilities and identify them. Although these approaches have shown vast potential in this task, they still suffer from the following issues: (1) It is difficult for them to distinguish vulnerability-related information from a large amount of irrelevant information, which hinders their effectiveness in capturing vulnerability features. (2) They are less effective in handling long code because many neural models would limit the input length, which hinders their ability to represent the long vulnerable code snippets. To mitigate these two issues, in this work, we proposed to decompose the syntax-based Control Flow Graph (CFG) of the code snippet into multiple execution paths to detect the vulnerability. Specifically, given a code snippet, we first build its CFG based on its Abstract Syntax Tree (AST), refer to such CFG as syntax-based CFG, and decompose the CFG into multiple paths from an entry node to its exit node. Next, we adopt a pre-trained code model and a convolutional neural network to learn the path representations with intra- and inter-path attention. The feature vectors of the paths are combined as the representation of the code snippet and fed into the classifier to detect the vulnerability. Decomposing the code snippet into multiple paths can filter out some redundant information unrelated to the vulnerability and help the model focus on the vulnerability features. Besides, since the decomposed paths are usually shorter than the code snippet, the information located in the tail of the long code is more likely to be processed and learned. To evaluate the effectiveness of our model, we build a dataset with over 231 k code snippets, in which there are 24 k vulnerabilities. Experimental results demonstrate that the proposed approach outperforms state-of-the-art baselines by at least 22.30%, 42.92%, and 32.58% in terms of Precision, Recall, and F1-Score, respectively. Our further analysis investigates the reason for the proposed approach's superiority.
Keywords:
Vulnerability detection
deep learning
control flow graph
pre-trained model

Journal

IEEE Transactions on Software Engineering cover
IEEE Transactions on Software Engineering
IF:
5.6
Papers:
2.9K
Citations:
1.1W

Organization

Z
zhejiang university
Scholars:
17.7W
Papers: 12.1W
Citations: 152
Cited Papers

Cited Papers

errShare
errSave
Television Viewing and Children's Health
err2007-02-23
err0
PREAI
errJyu‐Lin Chen; Christine M. Kennedy; Ann Froese‐Fretz
errShare
errSave
errShare
errSave
SySeVR: A Framework for Using Deep Learning to Detect Software Vulnerabilities
err2022-07-01
err261
errOAAI
errLi, Zhen; Zou, Deqing; Xu, Shouhuai; Jin, Hai; Zhu, Yawei; Chen, Zhaoxuan
errShare
errSave
Arsenic removal from aqueous solutions by adsorption using novel MIL-53(Fe) as a highly efficient adsorbent
err2015-01-01
err0
PREAI
errTuan. A. Vu; Giang. H. Le; Canh. D. Dao; Lan. Q. Dang; Kien. T. Nguyen; Quang. K. Nguyen; Phuong. T. Dang; Hoa. T. K. Tran; Quang. T. Duong; Tuyen. V. Nguyen; Gun. D. Lee
errShare
errSave
Improved Glycemic Control through Continuous Glucose Sensor-Augmented Insulin Pump Therapy: Prospective Results from a Community and Academic Practice Patient Registry
err2009-07-01
err0
errOAAI
errOhad Cohen; Anna Körner; Rudolf Chlup; Christos S. Zoupas; Anton K. Ragozin; Krisztina Wudi; Dagmar Bartaskova; Aggelos Pappas; Tamás Niederland; Zoltán Taybani; Lubomir Barák; Andriani Vazeou
errShare
errSave
researcher View more