VulTriage:基于LLM的漏洞检测三路径上下文增强
VulTriage: Triple-Path Context Augmentation for LLM-Based Vulnerability Detection
AI总结:
本文提出VulTriage框架,通过三路径上下文增强提升LLM在漏洞检测中的性能,实验表明其在关键指标上优于现有方法,且在低资源和类别不平衡场景下具有良好的泛化能力。
摘要:
自动化漏洞检测是软件安全中的基础任务,但现有基于学习的方法仍难以捕捉结构依赖、领域特定漏洞知识和复杂程序语义。最近的大型语言模型(LLM)在代码理解方面表现出色,但直接提示原始源代码常导致遗漏漏洞或误报,尤其当易受攻击和无害函数仅在细微语义细节上有所不同时。为此,我们提出了VulTriage,一种针对基于LLM的漏洞检测的三路径上下文增强框架。VulTriage通过三个互补路径增强LLM输入:控制路径提取并描述AST、CFG和DFG信息以暴露控制和数据依赖;知识路径通过混合密集-稀疏检索检索相关CWE衍生的漏洞模式和示例;语义路径在最终判断前总结代码的功能行为。这些上下文被整合到统一的指令中,引导LLM进行更可靠的漏洞推理。在PrimeVul配对测试集上的实验表明,VulTriage在关键配对和分类指标上实现了最先进的性能。进一步的消融研究验证了每条路径的有效性,额外在Kotlin数据集上的实验展示了VulTriage在低资源和类别不平衡设置下的泛化能力。我们的代码可在https://github.com/vinsontang1/VulTriage获取。
英文摘要:
Automated vulnerability detection is a fundamental task in software security, yet existing learning-based methods still struggle to capture the structural dependencies, domain-specific vulnerability knowledge, and complex program semantics required for accurate detection. Recent Large Language Models (LLMs) have shown strong code understanding ability, but directly prompting them with raw source code often leads to missed vulnerabilities or false alarms, especially when vulnerable and benign functions differ only in subtle semantic details. To address this, we propose VulTriage, a triple-path context augmentation framework for LLM-based vulnerability detection. VulTriage enhances the LLM input through three complementary paths: a Control Path that extracts and verbalizes AST, CFG, and DFG information to expose control and data dependencies; a Knowledge Path that retrieves relevant CWE-derived vulnerability patterns and examples through hybrid dense--sparse retrieval; and a Semantic Path that summarizes the functional behavior of the code before the final judgment. These contexts are integrated into a unified instruction to guide the LLM toward more reliable vulnerability reasoning. Experiments on the PrimeVul pair test set show that VulTriage achieves state-of-the-art performance, outperforming existing deep learning and LLM-based baselines on key pair-wise and classification metrics. Further ablation studies verify the effectiveness of each path, and additional experiments on the Kotlin dataset demonstrate the generalization ability of VulTriage under low-resource and class-imbalanced settings. Our code is available at https://github.com/vinsontang1/VulTriage
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。