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

言语胜于代码:探究基于LLM的代码漏洞检测中的认知启发式

Words Speak Louder Than Code: Investigating Cognitive Heuristics in LLM-Based Code Vulnerability Detection

BRAC University(布拉德大学);Purdue University(普渡大学);University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校)

Asif Shahriar, Hongyu Cai, Hadjer Benkraouda, Gang Wang, Z. Berkay Celik

AI总结:

本文首次系统探究认知启发式对LLM代码漏洞检测的影响,提出控制框架,发现所有评估模型均易受光环、框架和锚定效应影响,且语义推理型漏洞更易受影响。

摘要:

研究人员和从业者越来越多地应用大型语言模型(LLMs)进行自动化漏洞检测。最近的工作表明,LLMs容易受到与人类判断相同的认知启发式的影响。然而,尚无研究调查这些启发式是否影响模型对代码漏洞的评估。在本文中,我们首次系统探索了LLM驱动的代码漏洞检测中的认知启发式。我们引入了一个受控框架,该框架保持代码不变,仅改变周围上下文以触发三种认知启发式:通过作者归属产生的光环效应,通过任务目标和后果产生的框架效应,以及通过先前分析结果产生的锚定效应。在此框架内,我们评估了八种LLMs在三种编程语言上的表现,并进行了定量和代码级分析。我们的发现表明,所有评估的模型都容易受到这些启发式的影响。跨模型平均易感性最高的是框架效应,为33.2%,其次是锚定效应23.5%和光环效应18.4%。代码级分析揭示,需要语义推理才能检测的漏洞比通过模式匹配可识别的漏洞更容易受到认知启发式的影响。此外,模型经常根据认知条件将判决从安全改为脆弱,而没有准确识别实际漏洞。为了突出实际影响,我们展示了一个概念验证的黑盒认知攻击,该攻击可以抑制多达97%的先前检测到的漏洞。这些发现表明,认知易感性是基于LLM的漏洞检测的一致且可利用的特性。

英文摘要:

Researchers and practitioners increasingly apply Large Language Models (LLMs) for automated vulnerability detection. Recent work has shown that LLMs are susceptible to the same cognitive heuristics that bias human judgment. Yet, no work has investigated whether these heuristics affect a model's assessment of code vulnerabilities. In this paper, we present the first systematic exploration of cognitive heuristics in LLM-driven code vulnerability detection. We introduce a controlled framework that holds the code fixed and only varies the surrounding context to trigger three cognitive heuristics: the halo effect through author attribution, the framing effect through task objectives and consequences, and the anchoring effect through prior analysis results. Within this framework, we evaluate eight LLMs across three programming languages. Our results demonstrate that all evaluated models are susceptible to these heuristics. Cross-model average susceptibility is highest for framing at 33.2%, followed by anchoring at 23.5% and halo at 18.4%. Vulnerabilities that require semantic reasoning for detection are more susceptible to cognitive heuristics than those identifiable through pattern matching. Furthermore, models often change their verdict from safe to vulnerable based on the cognitive condition, without accurately identifying the actual vulnerability. To highlight the practical impact, we demonstrate a proof-of-concept black-box cognitive attack that can suppress up to 97\% of previously detected vulnerabilities. Together, these findings show that cognitive bias is a consistent and exploitable property of LLM-based vulnerability detection.

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

↑