VulnImGC:一种基于语法语义追踪图的漏洞检测方法

    VulnImGC: a vulnerability detection method based on syntax-semantics tracking graph

    • 摘要: 目前的代码漏洞检测中,研究人员仅仅将源码转换成了抽象语法树或者程序依赖图,然而抽象语法树更加侧重于代码的语法结构信息,程序依赖图更加侧重于代码的语义信息,这导致部分语义语法的缺失。除此之外,目前的工作无法有效识别漏洞代码片段中对漏洞有关键影响的代码行。因此,本文提出了一种基于语法语义追踪图的新型漏洞检测模型——VulnImGC(Vulnerability Identification based on multi-feature fusion with GNN and CNN)。模型首先将源码转化为以代码行为节点、带有额外的跳转边和变量使用边的抽象语法树,并基于此生成程序依赖图。然后,通过前向和后向切片技术生成图切片,并对其进行标准化处理和中心性分析,以识别核心代码行。模型结合了图神经网络和卷积神经网络的优势来提取整体的语义和结构特征以及核心代码行的语法特征,然后通过注意力池化层聚合特征并以此为依据检测代码是否含有漏洞。实验结果表明,相较之前工作,该模型在FFmpeg+Qemu和BigVul两个真实世界的数据集上表现优异。

       

      Abstract: In the current code vulnerability detection, researchers only convert source code into Abstract Syntax Tree (AST) or Program Dependency Graph (PDG), but AST focuses more on the syntax structure information of code, and PDG focuses more on the semantic information of code, which leads to the loss of some semantic syntax. In addition, current work does not effectively identify the lines of code in the vulnerability snippet that have a critical impact on the vulnerability. Therefore, VulnImGC (Vulnerability Identification based on multi-feature fusion with GNN and CNN), a new vulnerability detection model based on syntactic semantic trace graph, is proposed. The model first converts the source code into an AST of code behavior nodes with additional jump edges and variable usage edges, and then generates program dependency graph based on the AST. Then, the graph slices are generated by forward and backward slicing techniques, which are standardized and analyzed for centrality to identify core lines of code. The model combines the advantages of GNN (Graph Neural Network) and CNN (Convolutional Neural Network) to extract the overall semantic and structural features as well as the syntactic features of the core lines of code, and then aggregates the features through the attention pooling layer to detect whether the code contains vulnerabilities. The experimental results show that compared with previous work, the model achieves excellent performance on two real world datasets, FFmpeg+Qemu and BigVul.

       

    /

    返回文章
    返回