Skip to main content
QUICK REVIEW

[论文解读] Measuring and Exploiting Confirmation Bias in LLM-Assisted Security Code Review

Dimitris Mitropoulos, Nikolaos Alexopoulos|arXiv (Cornell University)|Mar 19, 2026
Software Engineering ResearchComputer Science被引用 0
一句话总结

论文表明,在基于LLM的安全代码审查中,确认偏差会降低漏洞检测效果,并演示对手如何通过偏见的PR元数据利用这一点;去偏见化可缓解该影响。

ABSTRACT

Security code reviews increasingly rely on systems integrating Large Language Models (LLMs), ranging from interactive assistants to autonomous agents in CI/CD pipelines. We study whether confirmation bias (i.e., the tendency to favor interpretations that align with prior expectations) affects LLM-based vulnerability detection, and whether this failure mode can be exploited in software supply-chain attacks. We conduct two complementary studies. Study 1 quantifies confirmation bias through controlled experiments on 250 CVE vulnerability/patch pairs evaluated across four state-of-the-art models under five framing conditions for the review prompt. Framing a change as bug-free reduces vulnerability detection rates by 16-93%, with strongly asymmetric effects: false negatives increase sharply while false positive rates change little. Bias effects vary by vulnerability type, with injection flaws being more susceptible to them than memory corruption bugs. Study 2 evaluates exploitability in practice mimicking adversarial pull requests that reintroduce known vulnerabilities while framed as security improvements or urgent functionality fixes via their pull request metadata. Adversarial framing succeeds in 35% of cases against GitHub Copilot (interactive assistant) under one-shot attacks and in 88% of cases against Claude Code (autonomous agent) in real project configurations where adversaries can iteratively refine their framing to increase attack success. Debiasing via metadata redaction and explicit instructions restores detection in all interactive cases and 94% of autonomous cases. Our results show that confirmation bias poses a weakness in LLM-based code review, with implications on how AI-assisted development tools are deployed.

研究动机与目标

  • 评估确认偏差是否影响基于LLM的漏洞检测在安全代码审查中的表现。
  • 量化分框设置在多模型和多种漏洞类型下对检测性能的影响。
  • 评估通过对抗性拉取请求在交互式与自治审查环境中对偏见的实际可利用性。
  • 探讨去偏见化方法与部署指南,以降低AI辅助审查工具中的偏见。

提出的方法

  • 在四个LLM下,以五种分框条件进行受控偏差实验,覆盖250对CVE–patched,总计约10,000次查询。
  • 人工对检测结果与CVE补丁进行验证,以评估超越自动度量的真实检测质量。
  • 计算偏差度量(真阳性率和假阳性率的变化)并使用两总体比例z检验结合Cohen’s h来衡量效应大小。
  • 通过构造对抗性PR在交互式和自治审查情境中模拟供应链攻击,回手修复并嵌入偏置诱导元数据。
  • 通过元数据的去标记化与显式指令评估去偏见化的效果,衡量检测的恢复情况。

实验结果

研究问题

  • RQ1RQ1:LLMs是否易受确认偏差影响漏洞检测,分框条件如何影响检测率及错误类型?
  • RQ2RQ2:哪些漏洞特征和代码属性会影响偏见易感性和攻击成功率?
  • RQ3RQ3:确认偏差是否会在基于LLM的代码审查中引发供应链攻击,去偏见化策略的效果如何?

主要发现

  • 在四种模型中,分框为“无缺陷”会大幅降低漏洞检测率(例如GPT-4o-mini从97.2%降至3.6%),假阴性显著增加。
  • 对打补丁代码在中性分框下的假阳性率较高(68.4–96.8%),且某些模型在偏见作用下进一步提高FPR(最高可达13.6个百分点)。
  • 偏差效应呈强烈非对称性:假阴性偏差占主导(4–114×)于假阳性偏差,造成精度悖论。
  • 对抗性PR分框在受控实验中显示明显的攻击成功率(对GitHub Copilot为35%;对Claude Code为88%),在自治设置中的迭代优化可提高成功率。
  • 通过元数据去标记化加上显式指令的去偏见化可恢复检测(自治情境最高可达93.75%),并在交互情境中实现完全恢复。
  • 研究提供部署指南和公开产物,以推动对鲁棒AI辅助安全审查的研究。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。