Covert Knowledge Poisoning Attacks in Retrieval-Augmented Code Generation
IEEE Transactions on Dependable and Secure Computing · 2026-07 · 23 (4) · 8649-8666
DOI: 10.1109/tdsc.2026.3686845 ↗Kurz gefasst
Fachartikel in der Zeitschrift IEEE Transactions on Dependable and Secure Computing, 2026-07. Verfasst von Yu Zhang und 5 weiteren Autor:innen. Die Arbeit nennt 77 Literaturangaben. Gefördert von: National Natural Science Foundation of China, Fundamental and Interdisciplinary Disciplines Breakthrough Plan of the Ministry of Education of China.
Abstract (Originalsprache)
Retrieval-Augmented Code Generation (RACG) systems enhance code generation by dynamically integrating examples retrieved from open knowledge bases, but their reliance on external sources exposes them to knowledge poisoning. While prior attacks inject explicit vulnerable code, such payloads are easily detected, limiting their real-world impact and failing to probe the full attack surface. To overcome this limitation, we propose Arachne, a covert knowledge poisoning attack that, for the first time, achieves fine-grained control over vulnerability types while evading detection. Arachne relies on two mechanisms: (1) Benign-Appearing Fragment Construction, where vulnerable code is decomposed into benign-appearing fragments that preserve compilability and contextual cues, rendering them effectively undetectable by vulnerability analyzers; and (2) Retrieval-Driven Knowledge Completion, in which retrieved fragments activate the large language model’s (LLM) contextual reasoning to autonomously generate complete vulnerable code. We evaluate Arachne on eight mainstream LLMs and four retrievers across four common vulnerability types. On GPT-4, Qwen2.5, Gemini-3-flash, Claude-4-sonnet and DeepSeekCoder, Arachne achieves attack success rates exceeding 70% in most settings for each vulnerability type across CWE-78, CWE-295, CWE-367, and CWE-614, peaking at 100% for CWE-367. Arachne demonstrates up to a 37% improvement in attack success rate over existing poisoning attacks. In two real-world applications, the attack achieves 87% success rate with 70% benign utility, indicating that the generated code often satisfies user requirements while introducing vulnerable code. Critically, our poisoned samples, which are designed without explicit malicious patterns, fully bypass rule-based analyzers and challenge state-of-the-art LLM-based detectors, exemplifying their stealth among multiple failed defense paradigms. Our findings expose critical limitations in existing defense frameworks, highlighting the urgent need for novel defense mechanisms specifically designed for RACG systems.
Förderung
- National Natural Science Foundation of China
- Fundamental and Interdisciplinary Disciplines Breakthrough Plan of the Ministry of Education of China
Zitieren
APA
Zhang, Y., Chen, M., He, X., Cong, T., Xu, K., & Li, Q. (2026). Covert Knowledge Poisoning Attacks in Retrieval-Augmented Code Generation. IEEE Transactions on Dependable and Secure Computing, 23(4), 8649-8666. https://doi.org/10.1109/tdsc.2026.3686845
Vancouver
Zhang Y, Chen M, He X, Cong T, Xu K, Li Q. Covert Knowledge Poisoning Attacks in Retrieval-Augmented Code Generation. IEEE Transactions on Dependable and Secure Computing. 2026;23(4):8649-8666. doi:10.1109/tdsc.2026.3686845
BibTeX
@article{Zhang2026,
author = {Zhang, Yu and Chen, Miao and He, Xinlei and Cong, Tianshuo and Xu, Ke and Li, Qi},
title = {Covert Knowledge Poisoning Attacks in Retrieval-Augmented Code Generation},
journal = {IEEE Transactions on Dependable and Secure Computing},
year = {2026},
volume = {23},
number = {4},
pages = {8649--8666},
doi = {10.1109/tdsc.2026.3686845}
}
EUVIMED