paper-with-me

홈 › Papers

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

2025-10-27 · Bin Wang, YiLu Zhong, MiDi Wan, WenJie Yu, YuanBing Ouyang, Yenan Huang, Hui Li 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.

📄 PDF Abstract BibTeX arXiv:2510.22944

Code (0)

등록된 구현이 없습니다.

Tasks

Code Generation

Similar Papers 제목 키워드 기반

Extroversion or Introversion? Controlling The Personality of Your Large Language Models

2024-06-07 · Yanquan Chen, Zhen Wu, Junjie Guo, ShuJian Huang 외

Large language models (LLMs) exhibit robust capabilities in text generation and comprehension, mimicking human behavior and exhibiting synthetic personalities. However, some LLMs have displayed offensive personality, pro…

Text Generation

Understanding Defects in Generated Codes by Language Models

2024-08-23 · Ali Mohammadi Esfahani, Nafiseh Kahani, Samuel A. Ajila

This study investigates the reliability of code generation by Large Language Models (LLMs), focusing on identifying and analyzing defects in the generated code. Despite the advanced capabilities of LLMs in automating cod…

Code GenerationPrompt Engineering

Compromising Embodied Agents with Contextual Backdoor Attacks

2024-08-06 · Aishan Liu, Yuguang Zhou, Xianglong Liu, Tianyuan Zhang 외

Large language models (LLMs) have transformed the development of embodied intelligence. By providing a few contextual demonstrations, developers can utilize the extensive internal knowledge of LLMs to effortlessly transl…

Autonomous DrivingRobot ManipulationVisual Reasoning

Show Me Your Code! Kill Code Poisoning: A Lightweight Method Based on Code Naturalness

2025-02-20 · Weisong Sun, Yuchen Chen, Mengzhe Yuan, Chunrong Fang 외

Neural code models (NCMs) have demonstrated extraordinary capabilities in code intelligence tasks. Meanwhile, the security of NCMs and NCMs-based systems has garnered increasing attention. In particular, NCMs are often t…

Backdoor AttackLanguage ModelingLanguage Modelling

Cordyceps: Covert Control Attacks on LLMs via Data Poisoning

2026-05-26 · Zedian Shao, Charles Fleming, Teodora Baluta arxiv

Large language models (LLMs) are often fine-tuned on uncurated text datasets that adversaries can poison. Existing poisoning attacks primarily rely on fixed trigger phrases that defenses such as outlier detection, clean-…

Outlier Detection