Detecting Data Poisoning in Code Generation LLMs via Black-Box, Vulnerability-Oriented Scanning
On the map: LLM safety and security → Jailbreaking
Abstract (arXiv)
Code generation large language models (LLMs) are increasingly integrated into modern software development workflows. Recent work has shown that these models are vulnerable to backdoor and poisoning attacks that induce the generation of insecure code, yet effective defenses remain limited. Existing scanning approaches rely on token-level generation consistency to invert attack targets, which is ineffective for source code where identical semantics can appear in diverse syntactic forms. We present CodeScan, the first black-box, vulnerability-specific scanning framework for auditing code generation LLMs, assuming that the defender specifies the target vulnerability classes and provides corresponding task-relevant prompts. CodeScan identifies attack targets by analyzing structural similarities across multiple generations conditioned on different clean prompts. It combines iterative divergence analysis with abstract syntax tree (AST)-based normalization to abstract away surface-level variation and unify semantically equivalent code, isolating structures that recur consistently across generations. CodeScan then applies LLM-based vulnerability analysis to determine whether the extracted structures contain security vulnerabilities and flags the model as compromised when such a structure is found. We evaluate CodeScan against four representative attacks under both backdoor and poisoning settings across three real-world vulnerability classes. Experiments on 117 models spanning three architectures and multiple model sizes demonstrate 97%+ detection accuracy with substantially lower false positives than prior methods.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Jailbreaking, one of 12 directions in LLM safety and security. Builds on 43 of its 69 references that are in the map. First posted on arXiv 17 Mar 2026.
Builds on
43 of 69 references.
Closest ancestors · 1
Same direction, newest first
Other references · 42
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2023GPT-4 Technical Reportcited by 18,396
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2019The Curious Case of Neural Text Degenerationcited by 2,916
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,443
- 2024Qwen2.5-Coder Technical Reportcited by 1,203
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2019Universal Adversarial Triggers for Attacking and Analyzing NLPcited by 722
- 2024Sleeper Agents: Training Deceptive LLMs that Persist Through Safety Trainingcited by 529
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
30 more
- 2019Hidden Trigger Backdoor Attackscited by 371
- 2022The Stack: 3 TB of permissively licensed source codecited by 359
- 2020Reflection Backdoor: A Natural Backdoor Attack on Deep Neural Networkscited by 349
- 2023Hard Prompts Made Easy: Gradient-Based Discrete Optimization for Prompt Tuning and Discoverycited by 336
- 2023Poisoning Web-Scale Training Datasets is Practicalcited by 290
- 2021Gradient-based Adversarial Attacks against Text Transformerscited by 234
- 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 221
- 2020BadNL: Backdoor Attacks against NLP Models with Semantic-preserving Improvementscited by 211
- 2020Clean-Label Backdoor Attacks on Video Recognition Modelscited by 169
- 2023Backdooring Instruction-Tuned Large Language Models with Virtual Prompt Injectioncited by 157
- 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 139
- 2020You Autocomplete Me: Poisoning Vulnerabilities in Neural Code Completioncited by 131
- 2024IRIS: LLM-Assisted Static Analysis for Detecting Security Vulnerabilitiescited by 103
- 2024BadEdit: Backdooring large language models by model editingcited by 96
- 2022Wild Patterns Reloaded: A Survey of Machine Learning Security against Training Data Poisoningcited by 94
- 2021BadPre: Task-agnostic Backdoor Attacks to Pre-trained NLP Foundation Modelscited by 85
- 2024BadChain: Backdoor Chain-of-Thought Prompting for Large Language Modelscited by 80
- 2023Composite Backdoor Attacks Against Large Language Modelscited by 73
- 2025Poisoning Attacks on LLMs Require a Near-constant Number of Poison Samplescited by 72
- 2023TrojanPuzzle: Covertly Poisoning Code-Suggestion Modelscited by 60
- 2023Detecting Backdoors in Pre-trained Encoderscited by 55
- 2022Constrained Optimization with Dynamic Bound-scaling for Effective NLPBackdoor Defensecited by 47
- 2022BadDet: Backdoor Attacks on Object Detectioncited by 45
- 2024Large Language Model for Vulnerability Detection and Repair: Literature Review and the Road Aheadcited by 42
- 2024An LLM-Assisted Easy-to-Trigger Backdoor Attack on Code Completion Models: Injecting Disguised Vulnerabilities against Strong Detectioncited by 40
- 2023Security Weaknesses of Copilot-Generated Code in GitHub Projects: An Empirical Studycited by 38
- 2024Assessing LLMs in Malicious Code Deobfuscation of Real-world Malware Campaignscited by 19
- 2025JsDeObsBench: Measuring and Benchmarking LLMs for JavaScript Deobfuscationcited by 7
- 2025A Systematic Study of Code Obfuscation Against LLM-based Vulnerability Detectioncited by 5
- 2025A Preliminary Study of Large Language Models for Multilingual Vulnerability Detectioncited by 2
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025A Mixture of Linear Corrections Generates Secure Code
- 2025Rethinking the Evaluation of Secure Code Generation
- 2024From Vulnerabilities to Remediation: A Systematic Literature Review of LLMs in Code Security
- 2026CodePoisonRAG: Knowledge Poisoning Attacks on Retrieval-Augmented Code Generation
- 2025Automated Vulnerability Validation and Verification: A Large Language Model Approach
- 2026Bridging Code Property Graphs and Language Models for Program Analysis ↗
- 2025Smoke and Mirrors: Jailbreaking LLM-based Code Generation via Implicit Malicious Prompts
- 2025Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation