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.
Resource Consumption Threats in Large Language Models
Beijing University of Posts and Telecommunications(北京邮电大学);Hangzhou Dianzi University(杭州电子科技大学);Nanyang Technological University(南洋理工大学);Chongqing University of Posts and Telecommunications(重庆邮电大学)
RAG-targeted Adversarial Attack on LLM-based Threat Detection and Mitigation Framework
Department of Computer Science(计算机科学系);Tennessee Tech University(田纳西科技大学);School of Interdisciplinary Informatics(跨学科信息学学院);University of Nebraska Omaha(内布拉斯加大学奥马哈分校)
ProjLens: Unveiling the Role of Projectors in Multimodal Model Safety
University of Science and Technology of China(中国科学技术大学);Beijing University of Aeronautics and Astronautics(北京航空航天大学);Nanyang Technological University(南洋理工大学);Southwest Jiaotong University(西南交通大学);Shanghai Artificial Intelligence Laboratory(上海人工智能实验室)
Generative AI in Cybersecurity: A Comprehensive Review of LLM Applications and Vulnerabilities
Guelma University(盖勒马大学);Technology Innovation Institute(技术创新研究院);Concordia University(康考迪亚大学);University of Oslo(奥斯陆大学);Khalifa University of Science and Technology(哈利法科技大学)
REDEditing: Relationship-Driven Precise Backdoor Poisoning on Text-to-Image Diffusion Models
Shanghai University(上海大学);Beijing University of Posts and Telecommunications(北京邮电大学);National University of Singapore(新加坡国立大学);Nanyang Technological University(南洋理工大学)