用专用推理大模型检测漏洞,比传统工具更准更快。
VulnLLM-R: Specialized Reasoning LLM with Agent Scaffold for Vulnerability Detection
- 构建专用推理模型,通过分析程序状态而非简单匹配模式。
- 在多语言数据集上优于现有静态分析工具和主流大模型。
- 集成智能代理框架,发现真实项目中的零日漏洞。
我们提出VulnLLM-R,首个用于漏洞检测的专用推理大模型。核心思想是让大模型能分析程序状态并识别潜在漏洞,而非仅依赖模式匹配,从而提升泛化能力并避免学习捷径。针对当前顶级推理模型普遍存在参数量大、闭源或漏洞检测性能有限的问题,我们设计了包含专用数据筛选、推理数据生成、过滤修正及测试阶段优化的全新训练方法。基于此方法,我们训练了一个70亿参数的推理模型。在涵盖Python、C/C++和Java的多个前沿数据集上,实验表明VulnLLM-R在有效性与效率上均优于现有静态分析工具及开源与商业大模型。进一步的消融实验验证了训练方案中关键设计的有效性。我们还为模型构建了智能代理框架,在真实项目中表现超越CodeQL和AFL++,并成功发现多个活跃维护仓库中的零日漏洞。本工作开创性地实现了基于专用推理模型的AI代理在实际项目级漏洞检测中的应用。代码已公开于github。
原文摘要 · Abstract (English)
We propose VulnLLM-R, the~\emph{first specialized reasoning LLM} for vulnerability detection. Our key insight is that LLMs can reason about program states and analyze the potential vulnerabilities, rather than simple pattern matching. This can improve the model's generalizability and prevent learning shortcuts. However, SOTA reasoning LLMs are typically ultra-large, closed-source, or have limited performance in vulnerability detection. To address this, we propose a novel training recipe with specialized data selection, reasoning data generation, reasoning data filtering and correction, and testing-phase optimization. Using our proposed methodology, we train a reasoning model with seven billion parameters. Through extensive experiments on SOTA datasets across Python, C/C++, and Java, we show that VulnLLM-R has superior effectiveness and efficiency than SOTA static analysis tools and both open-source and commercial large reasoning models. We further conduct a detailed ablation study to validate the key designs in our training recipe. Finally, we construct an agent scaffold around our model and show that it outperforms CodeQL and AFL++ in real-world projects. Our agent further discovers a set of zero-day vulnerabilities in actively maintained repositories. This work represents a pioneering effort to enable real-world, project-level vulnerability detection using AI agents powered by specialized reasoning models. The code is available at~\href{https://github.com/ucsb-mlsec/VulnLLM-R}{github}.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。