mlsanityData to 14 Oct 2026

Detecting Stealthy Data Poisoning Attacks in AI Code Generators

arXiv 2508.21636 ↗First posted 29 Aug 2025cs.CR cs.SEcited by 1

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

Abstract (arXiv)

Deep learning (DL) models for natural language-to-code generation have become integral to modern software development pipelines. However, their heavy reliance on large amounts of data, often collected from unsanitized online sources, exposes them to data poisoning attacks, where adversaries inject malicious samples to subtly bias model behavior. Recent targeted attacks silently replace secure code with semantically equivalent but vulnerable implementations without relying on explicit triggers to launch the attack, making it especially hard for detection methods to distinguish clean from poisoned samples. We present a systematic study on the effectiveness of existing poisoning detection methods under this stealthy threat model. Specifically, we perform targeted poisoning on three DL models (CodeBERT, CodeT5+, AST-T5), and evaluate spectral signatures analysis, activation clustering, and static analysis as defenses. Our results show that all methods struggle to detect triggerless poisoning, with representation-based approaches failing to isolate poisoned samples and static analysis suffering false positives and false negatives, highlighting the need for more robust, trigger-independent defenses for AI-assisted code generation.

Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Placed in Backdoor and data poisoning attacks, one of 12 directions in LLM safety and security. Builds on 17 of its 26 references that are in the map. First posted on arXiv 29 Aug 2025.

Builds on

17 of 26 references.

Closest ancestors · 6

Same direction, newest first

  1. 2024Measuring Impacts of Poisoning on Model Parameters and Embeddings for Large Language Models of Code19 May
  2. 2024Poisoning Programs by Un-Repairing Code: Security Concerns of AI-generated Code11 Mar
  3. 2023Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attacks4 Aug
  4. 2023Backdooring Neural Code Search27 May
  5. 2023Stealthy Backdoor Attack for Code Models6 Jan
  6. 2021Poison Forensics: Traceback of Data Poisoning Attacks in Neural Networks13 Oct

Other references · 11

  1. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  2. 2018Spectral Signatures in Backdoor Attackscited by 484
  3. 2018Detecting Backdoor Attacks on Deep Neural Networks by Activation Clusteringcited by 456
  4. 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 333
  5. 2021SPECTRE: Defending Against Backdoor Attacks Using Robust Statisticscited by 130
  6. 2023LLMSecEval: A Dataset of Natural Language Prompts for Security Evaluationscited by 62
  7. 2023TrojanPuzzle: Covertly Poisoning Code-Suggestion Modelscited by 60
  8. 2020Backdoors in Neural Models of Source Codecited by 41
  9. 2024AST-T5: Structure-Aware Pretraining for Code Generation and Understandingcited by 33
  10. 2022Who Evaluates the Evaluators? On Automatic Metrics for Assessing AI-based Offensive Code Generatorscited by 11
  11. 2025Quality In, Quality Out: Investigating Training Data's Role in AI Code Generationcited by 3

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 1.

1 paper.

Similar, not cited

Close in wording, no citation either way

  1. 2022Poison Attack and Defense on Deep Source Code Processing Models
  2. 2023TrojanedCM: A Repository of Trojaned Large Language Models of Code
  3. 2023Forcing Generative Models to Degenerate Ones: The Power of Data Poisoning Attacks
  4. 2024CodePurify: Defend Backdoor Attacks on Neural Code Models via Entropy-based Purification
  5. 2024Measuring Impacts of Poisoning on Model Parameters and Neuron Activations: A Case Study of Poisoning CodeBERT
  6. 2024Double Backdoored: Converting Code Large Language Model Backdoors to Traditional Malware via Adversarial Instruction Tuning Attacks
  7. 2025MT4DP: Data Poisoning Attack Detection for DL-based Code Search Models via Metamorphic Testing
  8. 2026Cordyceps: Covert Control Attacks on LLMs via Data Poisoning