arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2403.19096cs.SEcs.CR
收藏

SCALE:构建结构化自然语言注释树用于软件漏洞检测

SCALE: Constructing Structured Natural Language Comment Trees for Software Vulnerability Detection

Xin-Cheng Wen, Cuiyun Gao, Shuzheng Gao, Yang Xiao, Michael R. Lyu

AI总结:

SCALE框架通过构建结构化自然语言注释树,将代码语句语义与执行序列融入预训练模型,以提升软件漏洞检测能力。

摘要:

近年来,人们对自动软件漏洞检测的兴趣日益增长。基于预训练模型的方法在漏洞检测中表现出优于其他基于深度学习(DL)方法的性能。然而,现有的基于预训练模型的方法通常在预测时将代码序列作为输入,可能忽略与漏洞相关的结构信息,这体现在以下两个方面。首先,它们往往难以推断包含多个运算符和指针等复杂逻辑的代码语句的语义。其次,它们难以理解各种代码执行序列,而这对精确的漏洞检测至关重要。为了缓解这些挑战,我们提出了一种基于预训练模型的、名为SCALE的结构化自然语言注释树漏洞检测框架。所提出的结构化自然语言注释树(SCT)基于抽象语法树(AST)将代码语句的语义与代码执行序列相结合。具体而言,SCALE包含三个主要模块:(1)注释树构建,旨在通过首先引入大语言模型(LLM)进行注释生成,然后将注释节点添加到AST中,从而增强模型推断代码语句语义的能力。(2)结构化自然语言注释树构建,旨在通过将代码语法模板与注释树相结合,显式地引入代码执行序列。(3)SCT增强表示,最终融合所构建的SCT以更好地捕获漏洞模式。

英文摘要:

Recently, there has been a growing interest in automatic software vulnerability detection. Pre-trained model-based approaches have demonstrated superior performance than other Deep Learning (DL)-based approaches in detecting vulnerabilities. However, the existing pre-trained model-based approaches generally employ code sequences as input during prediction, and may ignore vulnerability-related structural information, as reflected in the following two aspects. First, they tend to fail to infer the semantics of the code statements with complex logic such as those containing multiple operators and pointers. Second, they are hard to comprehend various code execution sequences, which is essential for precise vulnerability detection. To mitigate the challenges, we propose a Structured Natural Language Comment tree-based vulnerAbiLity dEtection framework based on the pre-trained models, named SCALE. The proposed Structured Natural Language Comment Tree (SCT) integrates the semantics of code statements with code execution sequences based on the Abstract Syntax Trees (ASTs). Specifically, SCALE comprises three main modules: (1) Comment Tree Construction, which aims at enhancing the model's ability to infer the semantics of code statements by first incorporating Large Language Models (LLMs) for comment generation and then adding the comment node to ASTs. (2) Structured Natural Language Comment Tree Construction}, which aims at explicitly involving code execution sequence by combining the code syntax templates with the comment tree. (3) SCT-Enhanced Representation, which finally incorporates the constructed SCTs for well capturing vulnerability patterns.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑