arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2503.03586cs.CR
收藏

在代码仓库实际漏洞检测中对 LLM 与基于 LLM 的智能体进行基准测试

Benchmarking LLMs and LLM-based Agents in Practical Vulnerability Detection for Code Repositories

Alperen Yildiz, Sin G. Teo, Yiling Lou, Yebo Feng, Chong Wang, Dinil M. Divakaran

AI总结:

本文提出 JitVul 仓库级 JIT 漏洞检测基准,通过关联引入与修复提交,评估 LLM 与 ReAct Agents 在过程间代码漏洞检测中的表现。

摘要:

大语言模型(LLM)已在软件漏洞检测中展现出潜力,尤其是在 Devign 和 BigVul 等函数级基准上。然而,真实世界中的检测需要过程间分析,因为漏洞往往通过多跳函数调用而非孤立函数产生。尽管 ReposVul 和 VulEval 等仓库级基准引入了过程间上下文,但它们仍计算成本高昂、缺乏针对漏洞修复的成对评估,并且对上下文检索的探索有限,从而限制了其实用性。我们提出 JitVul,这是一个 JIT 漏洞检测基准,将每个函数与其引入漏洞和修复漏洞的提交关联起来。JitVul 基于覆盖 91 种漏洞类型的 879 个 CVE 构建,能够对检测能力进行全面评估。我们的结果表明,利用 thought-action-observation(思考—行动—观察)和过程间上下文的 ReAct Agents 在区分易受攻击代码与良性代码方面优于 LLM。虽然 Chain-of-Thought 等提示策略有助于 LLM,但 ReAct Agents 仍需进一步改进。两种方法都表现出不一致性,要么错误识别漏洞,要么对安全防护措施过度分析,表明仍有显著提升空间。

英文摘要:

Large Language Models (LLMs) have shown promise in software vulnerability detection, particularly on function-level benchmarks like Devign and BigVul. However, real-world detection requires interprocedural analysis, as vulnerabilities often emerge through multi-hop function calls rather than isolated functions. While repository-level benchmarks like ReposVul and VulEval introduce interprocedural context, they remain computationally expensive, lack pairwise evaluation of vulnerability fixes, and explore limited context retrieval, limiting their practicality. We introduce JitVul, a JIT vulnerability detection benchmark linking each function to its vulnerability-introducing and fixing commits. Built from 879 CVEs spanning 91 vulnerability types, JitVul enables comprehensive evaluation of detection capabilities. Our results show that ReAct Agents, leveraging thought-action-observation and interprocedural context, perform better than LLMs in distinguishing vulnerable from benign code. While prompting strategies like Chain-of-Thought help LLMs, ReAct Agents require further refinement. Both methods show inconsistencies, either misidentifying vulnerabilities or over-analyzing security guards, indicating significant room for improvement.

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

↑