mlsanityData to 7 Oct 2026

Is Your Prompt Poisoning Code? Defect Induction Rates and Security Mitigation Strategies

arXiv 2510.22944 ↗First posted 27 Oct 2025cs.CR cs.AIcited by 3

Not on the map. Why?

Abstract (arXiv)

Large language models (LLMs) have become indispensable for automated code generation, yet the quality and security of their outputs remain a critical concern. Existing studies predominantly concentrate on adversarial attacks or inherent flaws within the models. However, a more prevalent yet underexplored issue concerns how the quality of a benign but poorly formulated prompt affects the security of the generated code. To investigate this, we first propose an evaluation framework for prompt quality encompassing three key dimensions: goal clarity, information completeness, and logical consistency. Based on this framework, we construct and publicly release CWE-BENCH-PYTHON, a large-scale benchmark dataset containing tasks with prompts categorized into four distinct levels of normativity (L0-L3). Extensive experiments on multiple state-of-the-art LLMs reveal a clear correlation: as prompt normativity decreases, the likelihood of generating insecure code consistently and markedly increases. Furthermore, we demonstrate that advanced prompting techniques, such as Chain-of-Thought and Self-Correction, effectively mitigate the security risks introduced by low-quality prompts, substantially improving code safety. Our findings highlight that enhancing the quality of user prompts constitutes a critical and effective strategy for strengthening the security of AI-generated code.

Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 30 of its 46 references that are in the map. First posted on arXiv 27 Oct 2025.

Builds on

30 of 46 references.

References · 30

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  3. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  5. 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,317
  6. 2022Survey of Hallucination in Natural Language Generationcited by 2,056
  7. 2020Shortcut Learning in Deep Neural Networkscited by 1,928
  8. 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,339
  9. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
  10. 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
  11. 2022Do Users Write More Insecure Code with AI Assistants?cited by 186
  12. 2023Large Language Models for Software Engineering: Survey and Open Problemscited by 178
18 more
  1. 2024Optimization-based Prompt Injection Attack to LLM-as-a-Judgecited by 123
  2. 2023An Analysis of the Automatic Bug Fixing Performance of ChatGPTcited by 108
  3. 2021Examining Zero-Shot Vulnerability Repair with Large Language Modelscited by 105
  4. 2024IRIS: LLM-Assisted Static Analysis for Detecting Security Vulnerabilitiescited by 100
  5. 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?cited by 89
  6. 2023Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issuescited by 78
  7. 2023How Secure is Code Generated by ChatGPT?cited by 77
  8. 2023LLMSecEval: A Dataset of Natural Language Prompts for Security Evaluationscited by 58
  9. 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 52
  10. 2023Large Language Models Are Not Strong Abstract Reasonerscited by 52
  11. 2023WaveCoder: Widespread And Versatile Enhancement For Code Large Language Models By Instruction Tuningcited by 42
  12. 2023Security Weaknesses of Copilot-Generated Code in GitHub Projects: An Empirical Studycited by 36
  13. 2025Multi-Agent-as-Judge: Aligning LLM-Agent-Based Automated Evaluation with Multi-Dimensional Human Evaluationcited by 26
  14. 2023Assessing the Security of GitHub Copilot Generated Code -- A Targeted Replication Studycited by 24
  15. 2025A.S.E: A Repository-Level Benchmark for Evaluating Security in AI-Generated Codecited by 12
  16. 2024An Investigation into Misuse of Java Security APIs by Large Language Modelscited by 11
  17. 2024How Well Do Large Language Models Serve as End-to-End Secure Code Agents for Python?cited by 7
  18. 2023Automating the Correctness Assessment of AI-generated Code for Security Contextscited by 6

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 1; 2026: 2.

3 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026An Empirical Evaluation of LLM-Generated Code Security Across Prompting Methods
  2. 2026Enhancing Reliability in LLM-Based Secure Code Generation
  3. 2025Benchmarking Prompt Engineering Techniques for Secure Code Generation with GPT Models
  4. 2025System Prompt Poisoning: Persistent Attacks on Large Language Models Beyond User Injection
  5. 2024Understanding Defects in Generated Codes by Language Models
  6. 2025Do Prompt Patterns Affect Code Quality? A First Empirical Assessment of ChatGPT-Generated Code
  7. 2026Poster: Rethinking Security in LLM Code Generation through Real-World Risk Scenarios
  8. 2024The Impact of Prompt Programming on Function-Level Code Generation