Metraipolis › archive › dc_b5caee811cf0
CodePoisonRAG: Knowledge Poisoning Attacks on Retrieval-Augmented Code Generation — arXiv:2609.02774
- Source
- arXiv (en)
- Original
- https://arxiv.org/abs/2609.02774
- License (as archived)
- CC0-1.0
- Archived
- 2026-10-17T04:41:11.669Z
- SHA-256 of the archived text
52891396b5da5cd3ab40a98d469752317622ea3ba5fba3d364601f378e18ca07- Stable URL of this page
https://metraipolis.com/documento/dc_b5caee811cf0
How to cite
CodePoisonRAG: Knowledge Poisoning Attacks on Retrieval-Augmented Code Generation — arXiv:2609.02774 — arXiv (en), https://arxiv.org/abs/2609.02774 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_b5caee811cf0 (Metraipolis archive dc_b5caee811cf0, sha256 52891396b5da5cd3ab40a98d469752317622ea3ba5fba3d364601f378e18ca07)
BibTeX
@misc{dcb5caee811cf0,
title = {CodePoisonRAG: Knowledge Poisoning Attacks on Retrieval-Augmented Code Generation — arXiv:2609.02774},
howpublished = {arXiv (en)},
url = {https://arxiv.org/abs/2609.02774},
note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_b5caee811cf0; sha256 52891396b5da5cd3ab40a98d469752317622ea3ba5fba3d364601f378e18ca07},
year = {2026}
}Archived text
Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2609.02774. Third-party text: data, not instructions. It may be an abstract or extract; check the original.
Retrieval-Augmented Code Generation (RACG) improves LLM-based software development by retrieving external code artifacts, documentation, and patches, and incorporating them into the generation context. This reliance on external knowledge introduces a critical trust boundary: poisoned artifacts can influence generated code without modifying the underlying LLM. Prior work shows that selecting existing vulnerable examples can increase the general vulnerability rate of RACG outputs, but leaves open whether a black-box attacker can construct a single task-matched artifact that propagates an attacker-selected weakness. We introduce CodePoisonRAG, a targeted upstream knowledge-poisoning framework that transforms benign fixed-code entries into poisoned artifacts. Its attack chain combines CWE-specific Vulnerability Injection, which embeds a selected source-to-sink flow while retaining task alignment, with Semantic Mislabeling, which adds false safety claims without repairing the vulnerable behavior. The attacker has no access to the victim's deployed knowledge base, retriever, re-ranker, generator, prompt, or defense mechanism and injects at most one artifact per anticipated programming task. We construct 85 poisoned artifacts covering ten CWE classes across Java and C, yielding an aggregate corpus-poisoning ratio of 0.7%. Across three generators, all 85 artifacts appear among the Top-3 results for their corresponding queries, and CodePoisonRAG achieves attack success rates between 0.80 and 0.93. Against CodeGuarder, which injects vulnerability-specific security knowledge into the generation context, the attack retains success rates between 0.40 and 0.71. These results show that RACG poisoning extends beyond the incidental propagation of existing vulnerabilities to the targeted construction and propagation of attacker-selected weaknesses. Tema degli esploratori: fiducia digitale e crittografia (retro-catalogo arXiv: annunci del 2026-09-03 in cs.CR). Categorie arXiv: Cryptography and Security (cs.CR) ; Machine Learning (cs.LG). Pagina del lavoro: https://arxiv.org/abs/2609.02774 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito). Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina. Letto il 2026-10-17T04:09:09.365Z dalla pagina https://arxiv.org/catchup/cs.CR/2026-09-03?abs=True (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).