Vulnerability Detection via Multiple-Graph-Based Code Representation

IF 6.5 1区 计算机科学 Q1 COMPUTER SCIENCE, SOFTWARE ENGINEERING
Fangcheng Qiu;Zhongxin Liu;Xing Hu;Xin Xia;Gang Chen;Xinyu Wang
{"title":"Vulnerability Detection via Multiple-Graph-Based Code Representation","authors":"Fangcheng Qiu;Zhongxin Liu;Xing Hu;Xin Xia;Gang Chen;Xinyu Wang","doi":"10.1109/TSE.2024.3427815","DOIUrl":null,"url":null,"abstract":"During software development and maintenance, vulnerability detection is an essential part of software quality assurance. Even though many program-analysis-based and machine-learning-based approaches have been proposed to automatically detect vulnerabilities, they rely on explicit rules or patterns defined by security experts and suffer from either high false positives or high false negatives. Recently, an increasing number of studies leverage deep learning techniques, especially Graph Neural Network (GNN), to detect vulnerabilities. These approaches leverage program analysis to represent the program semantics as graphs and perform graph analysis to detect vulnerabilities. However, they suffer from two main problems: (i) Existing GNN-based techniques do not effectively learn the structural and semantic features from source code for vulnerability detection. (ii) These approaches tend to ignore fine-grained information in source code. To tackle these problems, in this paper, we propose a novel vulnerability detection approach, named \n<sc>MGVD</small>\n (\n<bold>M</b>\n \n<sc>ultiple</small>\n-\n<bold>G</b>\n \n<sc>raph-Based</small>\n \n<bold>V</b>\n \n<sc>ulnerability</small>\n \n<bold>D</b>\n \n<sc>etection)</small>\n, to detect vulnerable functions. To effectively learn the structural and semantic features from source code, \n<sc>MGVD</small>\n uses three different ways to represent each function into multiple forms, i.e., two statement graphs and a sequence of tokens. Then we encode such representations to a three-channel feature matrix. The feature matrix contains the structural feature and the semantic feature of the function. And we add a weight allocation layer to distribute the weights between structural and semantic features. To overcome the second problem, \n<sc>MGVD</small>\n constructs each graph representation of the input function using multiple different graphs instead of a single graph. Each graph focuses on one statement in the function and its nodes denote the related statements and their fine-grained code elements. Finally, \n<sc>MGVD</small>\n leverages CNN to identify whether this function is vulnerable based on such feature matrix. We conduct experiments on 3 vulnerability datasets with a total of 30,341 vulnerable functions and 127,931 non-vulnerable functions. The experimental results show that our method outperforms the state-of-the-art by 9.68% – 10.28% in terms of F1-score.","PeriodicalId":13324,"journal":{"name":"IEEE Transactions on Software Engineering","volume":"50 8","pages":"2178-2199"},"PeriodicalIF":6.5000,"publicationDate":"2024-07-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"IEEE Transactions on Software Engineering","FirstCategoryId":"94","ListUrlMain":"https://ieeexplore.ieee.org/document/10596932/","RegionNum":1,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

Abstract

During software development and maintenance, vulnerability detection is an essential part of software quality assurance. Even though many program-analysis-based and machine-learning-based approaches have been proposed to automatically detect vulnerabilities, they rely on explicit rules or patterns defined by security experts and suffer from either high false positives or high false negatives. Recently, an increasing number of studies leverage deep learning techniques, especially Graph Neural Network (GNN), to detect vulnerabilities. These approaches leverage program analysis to represent the program semantics as graphs and perform graph analysis to detect vulnerabilities. However, they suffer from two main problems: (i) Existing GNN-based techniques do not effectively learn the structural and semantic features from source code for vulnerability detection. (ii) These approaches tend to ignore fine-grained information in source code. To tackle these problems, in this paper, we propose a novel vulnerability detection approach, named MGVD ( M ultiple - G raph-Based V ulnerability D etection) , to detect vulnerable functions. To effectively learn the structural and semantic features from source code, MGVD uses three different ways to represent each function into multiple forms, i.e., two statement graphs and a sequence of tokens. Then we encode such representations to a three-channel feature matrix. The feature matrix contains the structural feature and the semantic feature of the function. And we add a weight allocation layer to distribute the weights between structural and semantic features. To overcome the second problem, MGVD constructs each graph representation of the input function using multiple different graphs instead of a single graph. Each graph focuses on one statement in the function and its nodes denote the related statements and their fine-grained code elements. Finally, MGVD leverages CNN to identify whether this function is vulnerable based on such feature matrix. We conduct experiments on 3 vulnerability datasets with a total of 30,341 vulnerable functions and 127,931 non-vulnerable functions. The experimental results show that our method outperforms the state-of-the-art by 9.68% – 10.28% in terms of F1-score.
通过基于多图的代码表示进行漏洞检测
在软件开发和维护过程中,漏洞检测是软件质量保证的重要组成部分。尽管已经提出了许多基于程序分析和机器学习的方法来自动检测漏洞,但这些方法都依赖于安全专家定义的明确规则或模式,存在高假阳性或高假阴性的问题。最近,越来越多的研究利用深度学习技术,特别是图神经网络(GNN)来检测漏洞。这些方法利用程序分析将程序语义表示为图,并执行图分析来检测漏洞。然而,这些方法存在两个主要问题:(i) 现有的基于 GNN 的技术无法有效地从源代码中学习结构和语义特征来检测漏洞。(ii) 这些方法往往会忽略源代码中的细粒度信息。为了解决这些问题,我们在本文中提出了一种新型漏洞检测方法,命名为 MGVD(M ultiple-G raph-Based V ulnerability D etection),用于检测易受攻击的功能。为了从源代码中有效地学习结构和语义特征,MGVD 使用三种不同的方法将每个函数表示成多种形式,即两种语句图和一个标记序列。然后,我们将这些表示法编码为三通道特征矩阵。特征矩阵包含函数的结构特征和语义特征。我们还添加了一个权重分配层,在结构特征和语义特征之间分配权重。为了克服第二个问题,MGVD 使用多个不同的图而不是单一的图来构建输入函数的每个图表示。每个图聚焦于函数中的一个语句,其节点表示相关语句及其细粒度代码元素。最后,MGVD 利用 CNN 根据这些特征矩阵来识别该函数是否存在漏洞。我们在 3 个漏洞数据集上进行了实验,共有 30,341 个脆弱函数和 127,931 个非脆弱函数。实验结果表明,我们的方法在 F1 分数上比最先进的方法高出 9.68% - 10.28%。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
IEEE Transactions on Software Engineering
IEEE Transactions on Software Engineering 工程技术-工程:电子与电气
CiteScore
9.70
自引率
10.80%
发文量
724
审稿时长
6 months
期刊介绍: IEEE Transactions on Software Engineering seeks contributions comprising well-defined theoretical results and empirical studies with potential impacts on software construction, analysis, or management. The scope of this Transactions extends from fundamental mechanisms to the development of principles and their application in specific environments. Specific topic areas include: a) Development and maintenance methods and models: Techniques and principles for specifying, designing, and implementing software systems, encompassing notations and process models. b) Assessment methods: Software tests, validation, reliability models, test and diagnosis procedures, software redundancy, design for error control, and measurements and evaluation of process and product aspects. c) Software project management: Productivity factors, cost models, schedule and organizational issues, and standards. d) Tools and environments: Specific tools, integrated tool environments, associated architectures, databases, and parallel and distributed processing issues. e) System issues: Hardware-software trade-offs. f) State-of-the-art surveys: Syntheses and comprehensive reviews of the historical development within specific areas of interest.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信