Poster: Rethinking Security in LLM Code Generation through Real-World Risk Scenarios
Lixun Ma, Ruolong Ma, Bei Wang, Feng Wei, Zhenguang Liu, Lorenzo Cavallaro, Wentao Chen
Abstract
Large Language Models (LLMs) are widely used for code generation, yet their security behavior in realistic development workflows remains underexplored. Existing benchmarks often rely on explicitly specified security requirements, failing to capture real-world scenarios where prompts are frequently ambiguous or incomplete. In this paper, we adopt a developer-centric perspective and identify three representative risk scenarios that commonly lead to security vulnerabilities in LLM-generated code: Ambiguous Requirements, Under-Specified Operational Context, and Security--Functionality Conflict. Based on these scenarios, we construct a large-scale benchmark comprising 2,700 test cases, enabling fine-grained evaluation of LLM security under realistic conditions. Extensive evaluation of eight state-of-the-art LLMs reveals that all models exhibit average vulnerability rates exceeding 56\% across risk scenarios. We further demonstrate that security-aware prompting can substantially mitigate these risks, achieving up to 45\% improvement.
Create a lesson
Related papers
SecRespond: Benchmarking AI Agents for Real-World Post-Compromise Incident Response
Shared title terminology · Lehan Wang, Boli Chen, Ruixue Ding et al.
SecDrift: Measuring Sector-Conditioned Security Drift in AI-Generated Code
Shared title terminology · Narayanaswami Natraj Bharadwaj, Dhivya Chandramouleeswaran
APPA: Recoverable Information-Flow Control for Real-World LLM Agents
Shared title terminology · Arseny Kravchenko, Vadim Liventsev, Innokentii Konstantinov et al.
EXE-Bench: Ranking the Tradeoffs of AI-based Windows Malware Detectors for Real-World Usability
Shared title terminology · Andrea Ponte, Daniel Gibert, Matous Kozak et al.
Who Pays the Price? Stakeholder-Centric Prompt Injection Benchmarking for Real-world Web Agents
Shared title terminology · Zihao Wang, Yiming Li, Yutong Wu et al.
Belobog: Move Language Fuzzing Framework For Real-World Smart Contracts
Shared title terminology · Ziqiao Kong, Wanxu Xia, Zhengwei Li et al.