CodeAttack: Code-Based Adversarial Attacks for Pre-trained Programming Language Models
Not on the map. Why?
Abstract (arXiv)
Pre-trained programming language (PL) models (such as CodeT5, CodeBERT, GraphCodeBERT, etc.,) have the potential to automate software engineering tasks involving code understanding and code generation. However, these models operate in the natural channel of code, i.e., they are primarily concerned with the human understanding of the code. They are not robust to changes in the input and thus, are potentially susceptible to adversarial attacks in the natural channel. We propose, CodeAttack, a simple yet effective black-box attack model that uses code structure to generate effective, efficient, and imperceptible adversarial code samples and demonstrates the vulnerabilities of the state-of-the-art PL models to code-specific adversarial attacks. We evaluate the transferability of CodeAttack on several code-code (translation and repair) and code-NL (summarization) tasks across different programming languages. CodeAttack outperforms state-of-the-art adversarial NLP attack models to achieve the best overall drop in performance while being more efficient, imperceptible, consistent, and fluent. The code can be found at https://github.com/reddy-lab-code-research/CodeAttack.
Key facts. Cited by 48 papers in the map (data through 7 Oct 2026). Builds on 28 of its 43 references that are in the map. First posted on arXiv 31 May 2022.
Builds on
28 of 43 references.
References · 28
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
- 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,854
- 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,115
- 2016Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translationcited by 1,471
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2017RACE: Large-scale ReAding Comprehension Dataset From Examinationscited by 851
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2019Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailmentcited by 663
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2020BERT-ATTACK: Adversarial Attack Against BERT Using BERTcited by 488
16 more
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2018Generating Natural Language Adversarial Examplescited by 422
- 2018TextBugger: Generating Adversarial Text Against Real-world Applicationscited by 376
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2018Black-box Generation of Adversarial Text Sequences to Evade Deep Learning Classifierscited by 341
- 2020BAE: BERT-based Adversarial Examples for Text Classificationcited by 316
- 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 266
- 2019Combating Adversarial Misspellings with Robust Word Recognitioncited by 162
- 2016Technical Report on the CleverHans v2.1.0 Adversarial Examples Librarycited by 123
- 2018An Empirical Study on Learning Bug-Fixing Patches in the Wild via Neural Machine Translationcited by 106
- 2022Natural Attack for Pre-trained Models of Codecited by 72
- 2021DOBF: A Deobfuscation Pre-Training Objective for Programming Languagescited by 68
- 2019Adversarial Examples for Models of Codecited by 61
- 2020Semantic Robustness of Models of Source Codecited by 43
- 2018Greedy Attack and Gumbel Attack: Generating Adversarial Examples for Discrete Datacited by 37
- 2021Adversarial Robustness of Deep Code Comment Generationcited by 22
Built on by
Citing papers per year: 2022: 2; 2023: 8; 2024: 9; 2025: 21; 2026: 8.
48 papers.
Sort:
By area:
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
- 2022ReCode: Robustness Evaluation of Code Generation Modelscited by 100
- 2023Execution-based Code Generation using Deep Reinforcement Learningcited by 95
- 2023Transformers Meet Directed Graphscited by 39
- 2023DeceptPrompt: Exploiting LLM-driven Code Generation via Adversarial Natural Language Instructionscited by 31
- 2023Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attackscited by 29
- 2023Trustworthy and Synergistic Artificial Intelligence for Software Engineering: Vision and Roadmapscited by 19
- 2025Diagnosing and Mitigating Modality Interference in Multimodal Large Language Modelscited by 18
- 2024Do Large Code Models Understand Programming Concepts? Counterfactual Analysis for Code Predicatescited by 14
- 2024What can Large Language Models Capture about Code Functional Equivalence?cited by 13
- 2024Software Vulnerability and Functionality Assessment using LLMscited by 11
- 2022Unveiling Code Pre-Trained Models: Investigating Syntax and Semantics Capacitiescited by 9
36 more
- 2024Token Alignment via Character Matching for Subword Completioncited by 9
- 2024FLRT: Fluent Student-Teacher Redteamingcited by 9
- 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agentscited by 9
- 2025Why Not Act on What You Know? Unleashing Safety Potential of LLMs via Self-Aware Guard Enhancementcited by 8
- 2025RedCoder: Automated Multi-Turn Red Teaming for Code LLMscited by 8
- 2025Evolve the Method, Not the Prompts: Evolutionary Synthesis of Jailbreak Attacks on LLMscited by 7
- 2024Adversarial Training: A Surveycited by 6
- 2025NEXUS: Network Exploration for eXploiting Unsafe Sequences in Multi-Turn LLM Jailbreakscited by 6
- 2025Evaluating and Improving Robustness in Large Language Models: A Survey and Future Directionscited by 5
- 2025MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?cited by 5
- 2026ICON: Intent-Context Coupling for Efficient Multi-Turn Jailbreak Attackcited by 5
- 2024CodeFort: Robust Training for Code Generation Modelscited by 4
- 2025XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding Assistantscited by 4
- 2025Evaluate-and-Purify: Fortifying Code Language Models Against Adversarial Attacks Using LLM-as-a-Judgecited by 4
- 2025MUSE: MCTS-Driven Red Teaming Framework for Enhanced Multi-Turn Dialogue Safety in Large Language Modelscited by 4
- 2025A Systematic Study of Code Obfuscation Against LLM-based Vulnerability Detectioncited by 4
- 2026State-Dependent Safety Failures in Multi-Turn Language Model Interactioncited by 4
- 2023A Black-Box Attack on Code Models via Representation Nearest Neighbor Searchcited by 3
- 2023Enhancing Robustness of AI Offensive Code Generators via Data Augmentationcited by 3
- 2025Smaller = Weaker? Benchmarking Robustness of Quantized LLMs in Code Generationcited by 3
- 2025Paper Summary Attack: Jailbreaking LLMs through LLM Safety Paperscited by 3
- 2025HarmNet: A Framework for Adaptive Multi-Turn Jailbreak Attacks on Large Language Modelscited by 3
- 2026HogVul: Black-box Adversarial Code Generation Framework Against LM-based Vulnerability Detectorscited by 3
- 2026DRAINCODE: Stealthy Energy Consumption Attacks on Retrieval-Augmented Code Generation via Context Poisoningcited by 3
- 2024Compressed models are NOT miniature versions of large modelscited by 2
- 2025Adversarial Defence without Adversarial Defence: Enhancing Language Model Robustness via Instance-level Principal Component Removalcited by 2
- 2025AutoRed: A Free-form Adversarial Prompt Generation Framework for Automated Red Teamingcited by 1
- 2024Studying Vulnerable Code Entities in Rcited by 0
- 2025Cross-site scripting adversarial attacks based on deep reinforcement learning: Evaluation and extension studycited by 0
- 2025SDGO: Self-Discrimination-Guided Optimization for Consistent Safety in Large Language Modelscited by 0
- 2025Pluralistic Behavior Suite: Stress-Testing Multi-Turn Adherence to Custom Behavioral Policiescited by 0
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Casescited by 0
- 2026When Efficiency Backfires: Cascading LLMs Trigger Cascade Failure under Adversarial Attackcited by 0
- 2026A Jagged Frontier: Evaluating Robustness of Code Agents to Semantics-Preserving Transformationscited by 0
- 2026Representational alignment yields generalizable safety in language modelscited by 0
- 2026CS-Guard: Benchmarking LLM Guardrails for Code Generation Securitycited by 0
- 2026CS-Guard: Benchmarking LLM Guardrails for Code Generation Security9 Sep 2026
- 2026Representational alignment yields generalizable safety in language models3 Sep 2026
- 2026A Jagged Frontier: Evaluating Robustness of Code Agents to Semantics-Preserving Transformations18 Aug 2026
- 2026When Efficiency Backfires: Cascading LLMs Trigger Cascade Failure under Adversarial Attack17 May 2026
- 2026State-Dependent Safety Failures in Multi-Turn Language Model Interaction15 Mar 2026
- 2026ICON: Intent-Context Coupling for Efficient Multi-Turn Jailbreak Attack28 Jan 2026
- 2026DRAINCODE: Stealthy Energy Consumption Attacks on Retrieval-Augmented Code Generation via Context Poisoning28 Jan 2026
- 2026HogVul: Black-box Adversarial Code Generation Framework Against LM-based Vulnerability Detectors9 Jan 2026
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Cases20 Dec 2025
- 2025A Systematic Study of Code Obfuscation Against LLM-based Vulnerability Detection18 Dec 2025
- 2025Evolve the Method, Not the Prompts: Evolutionary Synthesis of Jailbreak Attacks on LLMs16 Nov 2025
- 2025Pluralistic Behavior Suite: Stress-Testing Multi-Turn Adherence to Custom Behavioral Policies7 Nov 2025
36 more
- 2025HarmNet: A Framework for Adaptive Multi-Turn Jailbreak Attacks on Large Language Models21 Oct 2025
- 2025AutoRed: A Free-form Adversarial Prompt Generation Framework for Automated Red Teaming9 Oct 2025
- 2025NEXUS: Network Exploration for eXploiting Unsafe Sequences in Multi-Turn LLM Jailbreaks3 Oct 2025
- 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agents2 Oct 2025
- 2025MUSE: MCTS-Driven Red Teaming Framework for Enhanced Multi-Turn Dialogue Safety in Large Language Models18 Sep 2025
- 2025SDGO: Self-Discrimination-Guided Optimization for Consistent Safety in Large Language Models21 Aug 2025
- 2025Adversarial Defence without Adversarial Defence: Enhancing Language Model Robustness via Instance-level Principal Component Removal29 Jul 2025
- 2025MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?25 Jul 2025
- 2025Paper Summary Attack: Jailbreaking LLMs through LLM Safety Papers17 Jul 2025
- 2025Smaller = Weaker? Benchmarking Robustness of Quantized LLMs in Code Generation28 Jun 2025
- 2025RedCoder: Automated Multi-Turn Red Teaming for Code LLMs25 Jun 2025
- 2025Evaluating and Improving Robustness in Large Language Models: A Survey and Future Directions8 Jun 2025
- 2025Diagnosing and Mitigating Modality Interference in Multimodal Large Language Models26 May 2025
- 2025Why Not Act on What You Know? Unleashing Safety Potential of LLMs via Self-Aware Guard Enhancement17 May 2025
- 2025Evaluate-and-Purify: Fortifying Code Language Models Against Adversarial Attacks Using LLM-as-a-Judge28 Apr 2025
- 2025XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding Assistants18 Mar 2025
- 2025Cross-site scripting adversarial attacks based on deep reinforcement learning: Evaluation and extension study26 Feb 2025
- 2024Adversarial Training: A Survey19 Oct 2024
- 2024What can Large Language Models Capture about Code Functional Equivalence?20 Aug 2024
- 2024FLRT: Fluent Student-Teacher Redteaming24 Jul 2024
- 2024Compressed models are NOT miniature versions of large models18 Jul 2024
- 2024CodeFort: Robust Training for Code Generation Models11 Apr 2024
- 2024Token Alignment via Character Matching for Subword Completion13 Mar 2024
- 2024Software Vulnerability and Functionality Assessment using LLMs13 Mar 2024
- 2024Do Large Code Models Understand Programming Concepts? Counterfactual Analysis for Code Predicates8 Feb 2024
- 2024Studying Vulnerable Code Entities in R6 Feb 2024
- 2023DeceptPrompt: Exploiting LLM-driven Code Generation via Adversarial Natural Language Instructions7 Dec 2023
- 2023Trustworthy and Synergistic Artificial Intelligence for Software Engineering: Vision and Roadmaps8 Sep 2023
- 2023Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attacks4 Aug 2023
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instruct14 Jun 2023
- 2023Enhancing Robustness of AI Offensive Code Generators via Data Augmentation8 Jun 2023
- 2023A Black-Box Attack on Code Models via Representation Nearest Neighbor Search10 May 2023
- 2023Transformers Meet Directed Graphs31 Jan 2023
- 2023Execution-based Code Generation using Deep Reinforcement Learning31 Jan 2023
- 2022ReCode: Robustness Evaluation of Code Generation Models20 Dec 2022
- 2022Unveiling Code Pre-Trained Models: Investigating Syntax and Semantics Capacities20 Dec 2022
- 2023Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attackscited by 29
- 2024FLRT: Fluent Student-Teacher Redteamingcited by 9
- 2025Why Not Act on What You Know? Unleashing Safety Potential of LLMs via Self-Aware Guard Enhancementcited by 8
- 2025RedCoder: Automated Multi-Turn Red Teaming for Code LLMscited by 8
- 2025Evolve the Method, Not the Prompts: Evolutionary Synthesis of Jailbreak Attacks on LLMscited by 7
- 2025NEXUS: Network Exploration for eXploiting Unsafe Sequences in Multi-Turn LLM Jailbreakscited by 6
- 2026ICON: Intent-Context Coupling for Efficient Multi-Turn Jailbreak Attackcited by 5
- 2025MUSE: MCTS-Driven Red Teaming Framework for Enhanced Multi-Turn Dialogue Safety in Large Language Modelscited by 4
- 2025Paper Summary Attack: Jailbreaking LLMs through LLM Safety Paperscited by 3
- 2025HarmNet: A Framework for Adaptive Multi-Turn Jailbreak Attacks on Large Language Modelscited by 3
- 2025AutoRed: A Free-form Adversarial Prompt Generation Framework for Automated Red Teamingcited by 1
- 2025SDGO: Self-Discrimination-Guided Optimization for Consistent Safety in Large Language Modelscited by 0
12 most cited of 13 All 13 (JSON)
- 2026CS-Guard: Benchmarking LLM Guardrails for Code Generation Security9 Sep 2026
- 2026ICON: Intent-Context Coupling for Efficient Multi-Turn Jailbreak Attack28 Jan 2026
- 2025Evolve the Method, Not the Prompts: Evolutionary Synthesis of Jailbreak Attacks on LLMs16 Nov 2025
- 2025HarmNet: A Framework for Adaptive Multi-Turn Jailbreak Attacks on Large Language Models21 Oct 2025
- 2025AutoRed: A Free-form Adversarial Prompt Generation Framework for Automated Red Teaming9 Oct 2025
- 2025NEXUS: Network Exploration for eXploiting Unsafe Sequences in Multi-Turn LLM Jailbreaks3 Oct 2025
- 2025MUSE: MCTS-Driven Red Teaming Framework for Enhanced Multi-Turn Dialogue Safety in Large Language Models18 Sep 2025
- 2025SDGO: Self-Discrimination-Guided Optimization for Consistent Safety in Large Language Models21 Aug 2025
- 2025Paper Summary Attack: Jailbreaking LLMs through LLM Safety Papers17 Jul 2025
- 2025RedCoder: Automated Multi-Turn Red Teaming for Code LLMs25 Jun 2025
- 2025Why Not Act on What You Know? Unleashing Safety Potential of LLMs via Self-Aware Guard Enhancement17 May 2025
- 2024FLRT: Fluent Student-Teacher Redteaming24 Jul 2024
12 newest of 13 All 13 (JSON)
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
- 2022ReCode: Robustness Evaluation of Code Generation Modelscited by 100
- 2023Execution-based Code Generation using Deep Reinforcement Learningcited by 95
- 2023Transformers Meet Directed Graphscited by 39
- 2023DeceptPrompt: Exploiting LLM-driven Code Generation via Adversarial Natural Language Instructionscited by 31
- 2023Trustworthy and Synergistic Artificial Intelligence for Software Engineering: Vision and Roadmapscited by 19
- 2024Do Large Code Models Understand Programming Concepts? Counterfactual Analysis for Code Predicatescited by 14
- 2024What can Large Language Models Capture about Code Functional Equivalence?cited by 13
- 2024Software Vulnerability and Functionality Assessment using LLMscited by 11
- 2022Unveiling Code Pre-Trained Models: Investigating Syntax and Semantics Capacitiescited by 9
- 2024Token Alignment via Character Matching for Subword Completioncited by 9
- 2024Adversarial Training: A Surveycited by 6
12 most cited of 29 All 29 (JSON)
- 2026When Efficiency Backfires: Cascading LLMs Trigger Cascade Failure under Adversarial Attack17 May 2026
- 2026HogVul: Black-box Adversarial Code Generation Framework Against LM-based Vulnerability Detectors9 Jan 2026
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Cases20 Dec 2025
- 2025A Systematic Study of Code Obfuscation Against LLM-based Vulnerability Detection18 Dec 2025
- 2025Pluralistic Behavior Suite: Stress-Testing Multi-Turn Adherence to Custom Behavioral Policies7 Nov 2025
- 2025Adversarial Defence without Adversarial Defence: Enhancing Language Model Robustness via Instance-level Principal Component Removal29 Jul 2025
- 2025MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?25 Jul 2025
- 2025Smaller = Weaker? Benchmarking Robustness of Quantized LLMs in Code Generation28 Jun 2025
- 2025Evaluating and Improving Robustness in Large Language Models: A Survey and Future Directions8 Jun 2025
- 2025Evaluate-and-Purify: Fortifying Code Language Models Against Adversarial Attacks Using LLM-as-a-Judge28 Apr 2025
- 2025XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding Assistants18 Mar 2025
- 2025Cross-site scripting adversarial attacks based on deep reinforcement learning: Evaluation and extension study26 Feb 2025
12 newest of 29 All 29 (JSON)