ShadowCode: Towards (Automatic) External Prompt Injection Attack against Code LLMs
Yuchen Yang, Yiming Li, Hongwei Yao, Bingrun Yang, Yiling He, Tianwei Zhang, Dacheng Tao, Zhan Qin

TL;DR
This paper introduces ShadowCode, an automatic external prompt injection attack on Code LLMs that uses non-functional perturbations to manipulate code completion, demonstrating high success rates across multiple models and languages.
Contribution
The paper presents ShadowCode, a novel method for generating stealthy external prompt injections that effectively attack Code LLMs without model control, outperforming existing attack techniques.
Findings
Achieves up to 97.9% success rate on open-source Code LLMs
Over 90% success rate on commercial Code LLM applications
Effective with only a 12-token non-functional perturbation
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsElectrostatic Discharge in Electronics · Semiconductor materials and devices · Integrated Circuits and Semiconductor Failure Analysis
