mlsanityData to 7 Oct 2026

DeceptPrompt: Exploiting LLM-driven Code Generation via Adversarial Natural Language Instructions

arXiv 2312.04730 ↗First posted 7 Dec 2023cs.CR cs.AIcited by 31

Not on the map. Why?

Abstract (arXiv)

With the advancement of Large Language Models (LLMs), significant progress has been made in code generation, enabling LLMs to transform natural language into programming code. These Code LLMs have been widely accepted by massive users and organizations. However, a dangerous nature is hidden in the code, which is the existence of fatal vulnerabilities. While some LLM providers have attempted to address these issues by aligning with human guidance, these efforts fall short of making Code LLMs practical and robust. Without a deep understanding of the performance of the LLMs under the practical worst cases, it would be concerning to apply them to various real-world applications. In this paper, we answer the critical issue: Are existing Code LLMs immune to generating vulnerable code? If not, what is the possible maximum severity of this issue in practical deployment scenarios? In this paper, we introduce DeceptPrompt, a novel algorithm that can generate adversarial natural language instructions that drive the Code LLMs to generate functionality correct code with vulnerabilities. DeceptPrompt is achieved through a systematic evolution-based algorithm with a fine grain loss design. The unique advantage of DeceptPrompt enables us to find natural prefix/suffix with totally benign and non-directional semantic meaning, meanwhile, having great power in inducing the Code LLMs to generate vulnerable code. This feature can enable us to conduct the almost-worstcase red-teaming on these LLMs in a real scenario, where users are using natural language. Our extensive experiments and analyses on DeceptPrompt not only validate the effectiveness of our approach but also shed light on the huge weakness of LLMs in the code generation task. When applying the optimized prefix/suffix, the attack success rate (ASR) will improve by average 50% compared with no prefix/suffix applying.

Key facts. Cited by 31 papers in the map (data through 7 Oct 2026). Builds on 31 of its 59 references that are in the map. First posted on arXiv 7 Dec 2023.

Builds on

31 of 59 references.

References · 31

  1. 2023GPT-4 Technical Reportcited by 18,132
  2. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  4. 2017Towards Deep Learning Models Resistant to Adversarial Attackscited by 6,326
  5. 2019The Curious Case of Neural Text Degenerationcited by 2,881
  6. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  7. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
  8. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
  9. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
  10. 2023StarCoder: may the source be with you!cited by 790
  11. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
  12. 2023Baseline Defenses for Adversarial Attacks Against Aligned Language Modelscited by 608
19 more
  1. 2018Threat of Adversarial Attacks on Deep Learning in Computer Vision: A Surveycited by 459
  2. 2021MetaICL: Learning to Learn In Contextcited by 450
  3. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
  4. 2018QuAC : Question Answering in Contextcited by 379
  5. 2017Adversarial Attacks on Neural Network Policiescited by 314
  6. 2023Mathematical Capabilities of ChatGPTcited by 263
  7. 2020IntelliCode Compose: Code Generation Using Transformercited by 225
  8. 2015Visualizing and Understanding Neural Models in NLPcited by 199
  9. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
  10. 2023Adversarial Demonstration Attacks on Large Language Modelscited by 58
  11. 2022CodeAttack: Code-Based Adversarial Attacks for Pre-trained Programming Language Modelscited by 48
  12. 2023TrojanPuzzle: Covertly Poisoning Code-Suggestion Modelscited by 47
  13. 2021Perfection Not Required? Human-AI Partnerships in Code Translationcited by 42
  14. 2023Evaluation of ChatGPT Model for Vulnerability Detectioncited by 33
  15. 2023An Independent Evaluation of ChatGPT on Mathematical Word Problems (MWP)cited by 31
  16. 2023Vulnerabilities in AI Code Generators: Exploring Targeted Data Poisoning Attackscited by 29
  17. 2021Adversarial Robustness of Deep Code Comment Generationcited by 22
  18. 2023AI Insights into Theoretical Physics and the Swampland Program: A Journey Through the Cosmos with ChatGPTcited by 10
  19. 2023A Preliminary Analysis on the Code Generation Capabilities of GPT-3.5 and Bard AI Models for Java Functionscited by 8

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 13; 2025: 12; 2026: 6.

31 papers.

Sort:

By area:

  1. 2024Attacks, Defenses and Evaluations for LLM Conversation Safety: A Surveycited by 124
  2. 2024Evolutionary Computation in the Era of Large Language Model: Survey and Roadmapcited by 89
  3. 2024Red-Teaming for Generative AI: Silver Bullet or Security Theater?cited by 81
  4. 2024Constrained Decoding for Secure Code Generationcited by 35
  5. 2024IRCoder: Intermediate Representations Make Language Models Robust Multilingual Code Generatorscited by 21
  6. 2025NeuroStrike: Neuron-Level Attacks on Aligned LLMscited by 18
  7. 2025Large Language Models (LLMs) for Source Code Analysis: applications, models and datasetscited by 15
  8. 2024Mitigating Backdoor Threats to Large Language Models: Advancement and Challengescited by 14
  9. 2024Black-Box Adversarial Attacks on LLM-Based Code Completioncited by 13
  10. 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 13
  11. 2024Just another copy and paste? Comparing the security vulnerabilities of ChatGPT generated code and StackOverflow answerscited by 12
  12. 2024Automated Progressive Red Teamingcited by 12
19 more
  1. 2025When Prompts Go Wrong: Evaluating Code Model Robustness to Ambiguous, Contradictory, and Incomplete Task Descriptionscited by 8
  2. 2025RedCoder: Automated Multi-Turn Red Teaming for Code LLMscited by 8
  3. 2024MaPPing Your Model: Assessing the Impact of Adversarial Attacks on LLM-based Programming Assistantscited by 5
  4. 2025MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?cited by 5
  5. 2026Fragile Thoughts: How Large Language Models Handle Chain-of-Thought Perturbationscited by 5
  6. 2024SeCodePLT: A Unified Platform for Evaluating the Security of Code GenAIcited by 4
  7. 2025XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding Assistantscited by 4
  8. 2025Chain-of-Code Collapse: Reasoning Failures in LLMs via Adversarial Prompting in Code Generationcited by 4
  9. 2025RAG-Pull: Turning Retrieval into a Code-Injection Channel via Invisible Unicode Perturbationscited by 4
  10. 2025A First Look at the Security Issues in the Model Context Protocol Ecosystemcited by 3
  11. 2025When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?cited by 2
  12. 2026NeST: Neuron Selective Tuning for LLM Safetycited by 2
  13. 2026Sleeper Cell: Injecting Latent Malice Temporal Backdoors into Tool-Using LLMscited by 2
  14. 2024Psychological Profiling in Cybersecurity: A Look at LLMs and Psycholinguistic Featurescited by 1
  15. 2026Surgical Repair of Insecure Code Generation in LLMscited by 1
  16. 2026IssueTrojanBench: Benchmarking AI Coding Agents Against Malicious Issue Requestscited by 1
  17. 2024Automated Creation of Source Code Variants of a Cryptographic Hash Function Implementation Using Generative Pre-Trained Transformer Modelscited by 0
  18. 2025AKD : Adversarial Knowledge Distillation For Large Language Models Alignment on Coding taskscited by 0
  19. 2026CS-Guard: Benchmarking LLM Guardrails for Code Generation Securitycited by 0