ShadowCode: Towards (Automatic) External Prompt Injection Attack against Code LLMs
State Key Laboratory of Blockchain and Data Security, Zhejiang University(区块链与数据安全国家重点实验室,浙江大学);Hangzhou High-Tech Zone (Binjiang) Institute of Blockchain and Data Security, Hangzhou(杭州高新区(滨江)区块链与数据安全研究院,杭州);College of Computing and Data Science, Nanyang Technological University(计算与数据科学学院,南洋理工大学)
Recent advancements have led to the widespread adoption of code-oriented large language models (Code LLMs) for programming tasks. Despite their success in deployment, their security research is left far behind. This paper introduces a new attack paradigm: (automatic) external prompt injection against Code LLMs, where attackers generate concise, non-functional induced perturbations and inject them within a victim's code context. These induced perturbations can be disseminated through commonly used dependencies (e.g., packages or RAG's knowledge base), manipulating Code LLMs to achieve malicious objectives during the code completion process. Compared to existing attacks, this method is more realistic and threatening: it does not necessitate control over the model's training process, unlike backdoor attacks, and can achieve specific malicious objectives that are challenging for adversarial attacks. Furthermore, we propose ShadowCode, a simple yet effective method that automatically generates induced perturbations based on code simulation to achieve effective and stealthy external prompt injection. ShadowCode designs its perturbation optimization objectives by simulating realistic code contexts and employs a greedy optimization approach with two enhancement modules: forward reasoning enhancement and keyword-based perturbation design. We evaluate our method across 13 distinct malicious objectives, generating 31 threat cases spanning three popular programming languages. Our results demonstrate that ShadowCode successfully attacks three representative open-source Code LLMs (achieving up to a 97.9% attack success rate) and two mainstream commercial Code LLM-integrated applications (with over 90% attack success rate) across all threat cases, using only a 12-token non-functional induced perturbation. The code is available at https://github.com/LianPing-cyber/ShadowCodeEPI.
Automated Vulnerability Injection in Smart Contracts Using Large Language Models
Università degli Studi di Napoli Federico II(那不勒斯费德里科二世大学);Gran Sasso Science Institute (GSSI)(格兰萨索科学研究所);University of Coimbra(科英布拉大学);College of Computing and Informatics, University of North Carolina at Charlotte(北卡罗来纳大学夏洛特分校计算与信息学院)
Large Language Model-Based Framework for Explainable Cyberattack Detection in Automatic Generation Control Systems
Department of Computer Science, College of Computing and Mathematical Sciences, Khalifa University(计算机科学系,计算与数学科学学院,哈利法大学);ECE Department, University of Toronto(电子工程系,多伦多大学);Concordia Institute for Information Systems Engineering (CIISE), Concordia University(信息系统工程研究所(CIISE),康科迪亚大学);Department of Electrical Engineering, College of Engineering and Physical Sciences, Khalifa University(电气工程系,工程与物理科学学院,哈利法大学)
Environmental Injection Attacks against GUI Agents in Realistic Dynamic Environments
College of AI, Tsinghua University(清华大学人工智能学院);Department of Computer Science and Technology, Tsinghua University(清华大学计算机科学与技术系);School of Computer Science, Peking University(北京大学计算机学院)