[论文解读] DefectHunter: A Novel LLM-Driven Boosted-Conformer-based Code Vulnerability Detection Mechanism
DefectHunter 将结构化代码图与 Conformer 基于架构以及 LLM 嵌入结合,用于检测漏洞,在 CWE、QEMU 和 FFmpeg 数据集上相对于基线实现显著的准确度提升。
One of the most pressing threats to computing systems is software vulnerabilities, which can compromise both hardware and software components. Existing methods for vulnerability detection remain suboptimal. Traditional techniques are both time-consuming and labor-intensive, while machine-learning-based approaches often underperform when applied to complex datasets, due to their inability to capture high-dimensional relationships. Previous deep-learning strategies also fall short in capturing sufficient feature information. Although self-attention mechanisms can process information over long distances, they fail to capture structural information. In this paper, we introduce DefectHunter, an innovative model for vulnerability identification that employs the Conformer mechanism. This mechanism fuses self-attention with convolutional networks to capture both local, position-wise features and global, content-based interactions. Furthermore, we optimize the self-attention mechanisms to mitigate the issue of excessive attention heads introducing extraneous noise by adjusting the denominator. We evaluated DefectHunter against ten baseline methods using six industrial and two highly complex datasets. On the QEMU dataset, DefectHunter exhibited a 20.62\% improvement in accuracy over Pongo-70B, and for the CWE-754 dataset, its accuracy was 14.64\% higher. To investigate how DefectHunter comprehends vulnerabilities, we conducted a case study, which revealed that our model effectively understands the mechanisms underlying vulnerabilities.
研究动机与目标
- 在传统静态/动态分析与纯深度学习之外,推动对代码漏洞的鲁棒检测。
- 提出一种基于 Conformer 的架构,将局部(卷积)与全局(自注意力)特征提取融合用于代码结构。
- 利用结构化代码图(AST/CFG/DFG)以及来自预训练 LLM 的语义代码嵌入以提升检测。
- 在多个人工与复杂数据集上进行评估,展示相较基线的性能提升并分析组件贡献。
提出的方法
- 通过结构信息处理从代码片段中推导 AST、CFG 与 DFG 表征。
- 用预训练代码模型对代码令牌进行嵌入,获得 Code Sequence Embeddings (CSEs)。
- 采用基于 Conformer 的模块,将卷积模块与多头自注意力及修改过的位置编码融合。
- 在 softmax 的注意力分母上进行修改,以降低多头注意力中过多头带来的噪声。
- 在融合的结构和语义特征上训练多层感知机分类器,以预测漏洞。
实验结果
研究问题
- RQ1将结构化代码图与语义嵌入整合如何影响漏洞检测性能?
- RQ2在该领域中,Conformer 架构相较于标准 Transformer 的优势是什么?
- RQ3对 Conformer 组件(AST/DFG/CFG、注意力修改、LLM 使用)的消融在不同数据集上对性能有何影响?
主要发现
- DefectHunter 在 CWE 数据集上相较基线获得更高的准确率,在特定 CWE 类型上 ACC 达到 0.9141–0.9999。
- 在 FFmpeg 与 QEMU 数据集上,DefectHunter 的 ACC 分别为 0.6653 和 0.6459,在许多指标上超越了若干基线。
- 与 Pongo-70B 相比,DefectHunter 在 CWE 数据集的 ACC 提升了 14.64 个百分点,在 QEMU 上提升了 20.62 个百分点。
- 消融结果表明 Conformer 和 LLM 组件对性能贡献显著,移除 AST/DFG/CFG 或 Conformer 模块后会有显著下降。
- DefectHunter 表明一个较小、经过良好调优的模型在漏洞检测中可超越更大规模的基于 LLM 的方法。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。