mlsanityData to 7 Oct 2026

Poison Attack and Defense on Deep Source Code Processing Models

arXiv 2210.17029 ↗First posted 31 Oct 2022cs.SE cs.AIcited by 8

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

Abstract (arXiv)

In the software engineering community, deep learning (DL) has recently been applied to many source code processing tasks. Due to the poor interpretability of DL models, their security vulnerabilities require scrutiny. Recently, researchers have identified an emergent security threat, namely poison attack. The attackers aim to inject insidious backdoors into models by poisoning the training data with poison samples. Poisoned models work normally with clean inputs but produce targeted erroneous results with poisoned inputs embedded with triggers. By activating backdoors, attackers can manipulate the poisoned models in security-related scenarios. To verify the vulnerability of existing deep source code processing models to the poison attack, we present a poison attack framework for source code named CodePoisoner as a strong imaginary enemy. CodePoisoner can produce compilable even human-imperceptible poison samples and attack models by poisoning the training data with poison samples. To defend against the poison attack, we further propose an effective defense approach named CodeDetector to detect poison samples in the training data. CodeDetector can be applied to many model architectures and effectively defend against multiple poison attack approaches. We apply our CodePoisoner and CodeDetector to three tasks, including defect detection, clone detection, and code repair. The results show that (1) CodePoisoner achieves a high attack success rate (max: 100%) in misleading models to targeted erroneous behaviors. It validates that existing deep source code processing models have a strong vulnerability to the poison attack. (2) CodeDetector effectively defends against multiple poison attack approaches by detecting (max: 100%) poison samples in the training data. We hope this work can help practitioners notice the poison attack and inspire the design of more advanced defense techniques.

Key facts. Cited by 8 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. Builds on 32 of its 58 references that are in the map. First posted on arXiv 31 Oct 2022.

Builds on

32 of 58 references.

Closest ancestors · 3

Same direction, newest first

  1. 2021Turn the Combination Lock: Learnable Textual Backdoor Attacks via Word Substitution11 Jun
  2. 2021Hidden Killer: Invisible Textual Backdoor Attacks with Syntactic Trigger26 May
  3. 2021Hidden Backdoors in Human-Centric Language Models1 May

Other references · 29

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2017Axiomatic Attribution for Deep Networkscited by 3,350
  4. 2014Sequence to Sequence Learning with Neural Networkscited by 2,974
  5. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  6. 2014Convolutional Neural Networks for Sentence Classificationcited by 1,124
  7. 2017BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chaincited by 1,052
  8. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  9. 2018Spectral Signatures in Backdoor Attackscited by 457
  10. 2018Detecting Backdoor Attacks on Deep Neural Networks by Activation Clusteringcited by 429
  11. 2020Weight Poisoning Attacks on Pre-trained Modelscited by 318
  12. 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 266
17 more
  1. 2020ONION: A Simple and Effective Defense Against Textual Backdoor Attackscited by 231
  2. 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
  3. 2018SequenceR: Sequence-to-Sequence Learning for End-to-End Program Repaircited by 144
  4. 2018An Empirical Study on Learning Bug-Fixing Patches in the Wild via Neural Machine Translationcited by 106
  5. 2020Practical Detection of Trojan Neural Networks: Data-Limited and Data-Free Casescited by 93
  6. 2018SySeVR: A Framework for Using Deep Learning to Detect Software Vulnerabilitiescited by 91
  7. 2021CURE: Code-Aware Neural Machine Translation for Automatic Program Repaircited by 85
  8. 2020Mitigating backdoor attacks in LSTM-based Text Classification Systems by Backdoor Keyword Identificationcited by 80
  9. 2020Rethinking the Trigger of Backdoor Attackcited by 76
  10. 2020Contrastive Code Representation Learningcited by 76
  11. 2020Detecting Code Clones with Graph Neural Networkand Flow-Augmented Abstract Syntax Treecited by 68
  12. 2019Adversarial Examples for Models of Codecited by 61
  13. 2021A Syntax-Guided Edit Decoder for Neural Program Repaircited by 57
  14. 2019When Deep Learning Met Code Searchcited by 45
  15. 2018CODIT: Code Editing with Tree-Based Neural Modelscited by 40
  16. 2021Combining Graph Neural Networks with Expert Knowledge for Smart Contract Vulnerability Detectioncited by 34
  17. 2016Automated Correction for Syntax Errors in Programming Assignments using Recurrent Neural Networkscited by 13

Built on by

Cited by year

Citing papers per year: 2023: 2; 2024: 2; 2025: 4.

8 papers.