IEEE S&P 2027 Paper: LLM Code Vulnerability Detection Susceptible to Cognitive Heuristics, Context Manipulation Suppresses 97% of Detections
New research confirms LLMs are biased by halo, framing, and anchoring effects in code security assessments, allowing attackers to hide vulnerabilities.
ImportanceMaterialEvidenceE2 unreplicatedWrite-upQuick
A study accepted for IEEE Symposium on Security and Privacy (S&P) 2027 provides the first systematic evidence that Large Language Models (LLMs) suffer from significant cognitive biases when used for automated code vulnerability detection. The research demonstrates that even when the code itself remains unchanged, altering surrounding context—such as author attribution, task objectives, or prior analysis results—can drastically distort model judgments.
Evaluating eight mainstream LLMs across three programming languages, the team found all models susceptible to these heuristics. The 'framing effect' (triggered by task goals and consequences descriptions) caused the highest average misjudgment rate at 33.2%, followed by the 'anchoring effect' (influenced by prior results) at 23.5%, and the 'halo effect' (influenced by author reputation) at 18.4%. Complex vulnerabilities requiring semantic reasoning were more prone to these biases than those identifiable through simple pattern matching.
Critically, the researchers demonstrated a black-box cognitive attack that successfully induced models to classify previously detected vulnerabilities as safe, thereby suppressing up to 97% of known detections. This finding highlights a systemic weakness in current LLM-based code auditing tools, suggesting that reliance on model capability without rigorous context isolation and prompt engineering creates exploitable security blind spots.