跳到正文
arXiv cs.AI· Asif Shahriar, Hongyu Cai, Hadjer Benkraouda, Gang Wang, Z. Berkay Celik·· 2 天前AI 评分47

LLM 代码漏洞检测中的认知启发式偏差研究

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

AI 导读

研究首次系统探索了 LLM 代码漏洞检测中的认知启发式偏差,通过固定代码、仅改变上下文的方式,在三种编程语言上评估了八款 LLM。结果显示所有模型均受影响,框架效应平均敏感度最高达 33.2%,锚定效应 23.5%,光环效应 18.4%。概念验证的黑盒认知攻击可抑制高达 97% 的已检测漏洞。

正文 · 原文

View PDF HTML (experimental)

Abstract: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.
Comments: Accepted at IEEE Symposium on Security and Privacy (IEEE S&P) 2027
Subjects: Cryptography and Security (cs.CR); Artificial Intelligence (cs.AI)
Cite as: arXiv:2606.30587 [cs.CR]
  (or arXiv:2606.30587v2 [cs.CR] for this version)
  https://doi.org/10.48550/arXiv.2606.30587

arXiv-issued DOI via DataCite

Submission history

From: Asif Shahriar [view email]
[v1] Mon, 29 Jun 2026 17:31:10 UTC (804 KB)
[v2] Thu, 15 Oct 2026 13:31:53 UTC (785 KB)

来源:arXiv cs.AI · arxiv.org