[Paper Review] Measuring and Exploiting Confirmation Bias in LLM-Assisted Security Code Review
The paper shows that confirmation bias in LLM-based security code review degrades vulnerability detection, and demonstrates how adversaries can exploit this through biased PR metadata; debiasing mitigates the effect.
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.
Motivation & Objective
- Assess whether confirmation bias affects LLM-based vulnerability detection in security code review.
- Quantify how framing changes detection performance across multiple models and vulnerability types.
- Evaluate practical exploitability of bias through adversarial pull requests in interactive and autonomous review setups.
- Investigate debiasing approaches and deployment guidance to mitigate bias in AI-assisted review tools.
Proposed method
- Conduct controlled bias experiments with 250 CVE–patched pairs across four LLMs under five framing conditions, totaling ~10,000 queries.
- Manually validate detections against CVE patches to assess true detection quality beyond automated metrics.
- Compute bias metrics (changes in true positive and false positive rates) and use two-proportion z-tests with Cohen’s h for effect sizes.
- Simulate supply-chain attacks by crafting adversarial PRs that revert fixes and embed bias-inducing metadata in both interactive and autonomous review contexts.
- Evaluate debiasing by metadata redaction and explicit instructions, measuring recovery of detections.
Experimental results
Research questions
- RQ1RQ1: Are LLMs susceptible to confirmation bias in vulnerability detection and how do framing conditions affect detection rates and error types?
- RQ2RQ2: Which vulnerability characteristics and code properties influence bias susceptibility and attack success?
- RQ3RQ3: Can confirmation bias enable supply-chain attacks in LLM-based code review, and how effective are debiasing strategies?
Key findings
- Framing as bug-free dramatically reduces vulnerability detection rates across four models (e.g., GPT-4o-mini from 97.2% to 3.6%), with large false-negative increases.
- False positives on patched code are high under neutral framing (68.4–96.8%), and bias can increase FPR further in some models (up to 13.6pp).
- Bias effects are strongly asymmetric: false-negative bias dominates (4–114×) over false-positive bias, creating a precision paradox.
- Adversarial PR framing yields substantial attack success (35% against GitHub Copilot; 88% against Claude Code) in controlled experiments, with iterative refinement increasing success in autonomous settings.
- Debiasing via metadata redaction plus explicit instructions recovers detections (up to 93.75% in autonomous cases) and fully recovers interactive cases.
- The work provides deployment guidance and public artifacts to advance research on robust AI-assisted security review.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.