arXiv:2603.18740cs.SEcs.AI2026-03综述被引 3

攻击者可利用代码提交描述误导大模型,绕过安全审查

Measuring and Exploiting Contextual Bias in LLM-Assisted Security Code Review

  • 通过精心设计的提交信息诱导大模型产生判断偏差
  • 迭代式攻击成功率100%,而固定模板攻击无效且易被发现
  • 适合关注AI辅助审阅安全性的开发者与安全团队

集成大语言模型(LLMs)的自动化代码审查(ACR)系统在软件开发中广泛应用。本文研究了呈现方式对基于LLM的漏洞检测的影响:即‘框架效应’——信息呈现方式会掩盖其语义内容,导致判断偏差。我们检验了攻击者能否通过注入上下文偏见(如伪造提交信息)来操纵真实世界的ACR安全判断,形成供应链攻击向量。通过在6个LLM上进行大规模探索性实验,发现框架效应普遍存在,且无漏洞的描述会引发最强偏差。随后在10个真实项目中评估17个已知漏洞,测试两种攻击策略:基于模板的攻击和一种新型的由大模型辅助的迭代优化攻击。结果表明,模板攻击无效甚至适得其反;而迭代攻击成功率达100%,因其利用了攻防不对称性——攻击者可反复调试本地副本,防御方仅有一击机会。通过删减元数据或添加明确指令可完全消除偏差。研究警示过度依赖自动审查的风险,强调人类监督与开发者信任的重要性。

原文摘要 · Abstract (English)

Automated Code Review (ACR) systems integrating Large Language Models (LLMs) are increasingly adopted in software development workflows, ranging from interactive assistants to autonomous agents in CI/CD pipelines. In this paper, we study how LLM-based vulnerability detection in ACR is affected by the framing effect: the tendency to let the presentation of information override its semantic content in forming judgments. We examine whether adversaries can exploit this through contextual-bias injection: crafting PR metadata to bias ACR security judgments as a supply-chain attack vector against real-world ACR pipelines. To this end, we first conduct a large-scale exploratory study across 6 LLMs under five framing conditions, establishing the framing effect as a systematic and widespread phenomenon in LLM-based vulnerability detection, with bug-free framing producing the strongest effect. We then design a realistic and controlled experimental environment, evaluating 17 CVEs across 10 real-world projects, to assess the susceptibility of real-world ACR pipelines to vulnerability reintroduction attacks. We employ two attack strategies: a template-based attack inspired by prior related work, and a novel LLM-assisted iterative refinement attack. We find that template-based attacks are ineffective and may even backfire, as direct biasing attempts raise suspicions. Our iterative refinement attack, on the other hand, achieves 100% success, exploiting a fundamental asymmetry: attackers can iteratively refine attacks against a local clone of the review pipeline, while defenders have only one chance to detect them. Debiasing via metadata redaction and explicit instructions restores detection in all affected cases. Overall, our findings highlight the dangers of over-relying on ACR and stress the importance of human oversight and contributor trust in the development process.

代码审查大模型安全供应链攻击上下文偏见

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。