mlsanityData to 7 Oct 2026

Stealthy Backdoor Attack for Code Models

arXiv 2301.02496 ↗First posted 6 Jan 2023cs.CR cs.SEcited by 32

On the map: LLM safety and security → Backdoor and data poisoning attacks

Abstract (arXiv)

Code models, such as CodeBERT and CodeT5, offer general-purpose representations of code and play a vital role in supporting downstream automated software engineering tasks. Most recently, code models were revealed to be vulnerable to backdoor attacks. A code model that is backdoor-attacked can behave normally on clean examples but will produce pre-defined malicious outputs on examples injected with triggers that activate the backdoors. Existing backdoor attacks on code models use unstealthy and easy-to-detect triggers. This paper aims to investigate the vulnerability of code models with stealthy backdoor attacks. To this end, we propose AFRAIDOOR (Adversarial Feature as Adaptive Backdoor). AFRAIDOOR achieves stealthiness by leveraging adversarial perturbations to inject adaptive triggers into different inputs. We evaluate AFRAIDOOR on three widely adopted code models (CodeBERT, PLBART and CodeT5) and two downstream tasks (code summarization and method name prediction). We find that around 85% of adaptive triggers in AFRAIDOOR bypass the detection in the defense process. By contrast, only less than 12% of the triggers from previous work bypass the defense. When the defense method is not applied, both AFRAIDOOR and baselines have almost perfect attack success rates. However, once a defense is applied, the success rates of baselines decrease dramatically to 10.47% and 12.06%, while the success rate of AFRAIDOOR are 77.05% and 92.98% on the two tasks. Our finding exposes security weaknesses in code models under stealthy backdoor attacks and shows that the state-of-the-art defense method cannot provide sufficient protection. We call for more research efforts in understanding security threats to code models and developing more effective countermeasures.

Key facts. Cited by 32 papers in the map (data through 7 Oct 2026). Placed in Backdoor and data poisoning attacks, one of 12 directions in LLM safety and security. First posted on arXiv 6 Jan 2023.

Builds on

No reference list yet.

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2023: 7; 2024: 10; 2025: 11; 2026: 4.

32 papers.

Sort:

By area:

  1. 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
  2. 2024Security and Privacy Challenges of Large Language Models: A Surveycited by 179
  3. 2023Privacy in Large Language Models: Attacks, Defenses and Future Directionscited by 48
  4. 2024Operationalizing a Threat Model for Red-Teaming Large Language Models (LLMs)cited by 44
  5. 2023Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attackscited by 29
  6. 2024Compromising Embodied Agents with Contextual Backdoor Attackscited by 29
  7. 2025REFINE: Inversion-Free Backdoor Defense via Model Reprogrammingcited by 20
  8. 2025Data Poisoning in Deep Learning: A Surveycited by 20
  9. 2023Multi-target Backdoor Attacks for Code Pre-trained Modelscited by 19
  10. 2023Trustworthy and Synergistic Artificial Intelligence for Software Engineering: Vision and Roadmapscited by 19
  11. 2024Mitigating Backdoor Threats to Large Language Models: Advancement and Challengescited by 14
  12. 2023Pitfalls in Language Models for Code Intelligence: A Taxonomy and Surveycited by 9
20 more
  1. 2025Erased but Not Forgotten: How Backdoors Compromise Concept Erasurecited by 9
  2. 2024PPM: Automated Generation of Diverse Programming Problems for Benchmarking Code Generation Modelscited by 7
  3. 2025"My productivity is boosted, but ..." Demystifying Users' Perception on AI Coding Assistantscited by 4
  4. 2026Beware What You Autocomplete: Forensic Attribution of Backdoored Code Completionscited by 4
  5. 2024Trading Devil: Robust backdoor attack via Stochastic investment models and Bayesian approachcited by 3
  6. 2025Show Me Your Code! Kill Code Poisoning: A Lightweight Method Based on Code Naturalnesscited by 3
  7. 2024Eliminating Backdoors in Neural Code Models for Secure Code Understandingcited by 2
  8. 2025Semantic-Preserving Transformations as Mutation Operators: A Study on Their Effectiveness in Defect Detectioncited by 2
  9. 2024Trojans in Large Language Models of Code: A Critical Review through a Trigger-Based Taxonomycited by 1
  10. 2025Beyond Natural Language Perplexity: Detecting Dead Code Poisoning in Code Generation Datasetscited by 1
  11. 2023Recover Triggered States: Protect Model Against Backdoor Attack in Reinforcement Learningcited by 0
  12. 2024A Disguised Wolf Is More Harmful Than a Toothless Tiger: Adaptive Malicious Code Injection Backdoor Attack Leveraging User Behavior as Triggerscited by 0
  13. 2024CodePurify: Defend Backdoor Attacks on Neural Code Models via Entropy-based Purificationcited by 0
  14. 2025Poisoned Source Code Detection in Code Modelscited by 0
  15. 2025Localizing Malicious Outputs from CodeLLMcited by 0
  16. 2025Signature in Code Backdoor Detection, how far are we?cited by 0
  17. 2025How Do Semantically Equivalent Code Transformations Impact Membership Inference on LLMs for Code?cited by 0
  18. 2026Words Speak Louder Than Code: Investigating Cognitive Heuristics in LLM-Based Code Vulnerability Detectioncited by 0
  19. 2026LoRAScan: Detecting Backdoor Prompts in Low-Rank Adapters for Large Language Models via Down-Projection Activation Spikescited by 0
  20. 2026Adversarial Testing of Automated Program Repair Agents for Security Vulnerabilitiescited by 0