Journal article · 2026 · Open access

Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation

Bo Lin, Shangwen Wang, Liqian Chen, Xiaoguang Mao

IEEE Transactions on Software Engineering, 52(8), 2250–2267 · Published 30 April 2026 · DOI 10.1109/tse.2026.3689066

Open PDFView at the publisherCite this paper

In brief

“Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation” is a 2026 journal article by Bo Lin and 3 co-authors, published in IEEE Transactions on Software Engineering. OpenAlex counts 24 citations as of 17 November 2026, which puts it in the top 3% of works published in 2026 by citations. It is open access: the full text is free to read at arXiv (Cornell University).

Citations
24
Most cited in
2026 (19)
Field-weighted impact
53.42
References
88
Authors
4

Abstract

The integration of Large Language Models (LLMs) into software development has revolutionized the field, particularly through the use of Retrieval-Augmented Code Generation (RACG) systems that enhance code generation with information from external knowledge bases. However, the security implications of RACG systems, particularly the risks posed by vulnerable code examples in the knowledge base, remain largely unexplored. This risk is particularly concerning given that public code repositories, which often serve as the sources for knowledge base collection in RACG systems, are usually accessible to anyone in the community. Malicious attackers can exploit this accessibility to inject vulnerable code into the knowledge base, making it toxic. Once these poisoned samples are retrieved and incorporated into the generated code, they can propagate security vulnerabilities into the final product. This paper presents the first comprehensive study on the security risks associated with RACG systems, focusing on how vulnerable code in the knowledge base compromises the security of generated code. We investigate the LLM-generated code security across different settings through extensive experiments using four major LLMs, two retrievers, and two poisoning scenarios. Our findings highlight the significant threat of knowledge base poisoning, where even a single poisoned code example can compromise up to 48% of generated code. Our findings provide crucial insights into vulnerability introduction in RACG systems and offer practical mitigation recommendations, thereby helping improve the security of LLM-generated code in future works.

Cite this paper

Formatted from the catalogue record. Check names, capitals and page numbers against the paper before you submit.

APA 7

Lin, B., Wang, S., Chen, L., & Mao, X. (2026). Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation. IEEE Transactions on Software Engineering, 52(8), 2250–2267. https://doi.org/10.1109/tse.2026.3689066

MLA 9

Lin, Bo, et al. “Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation.” IEEE Transactions on Software Engineering, vol. 52, no. 8, 2026, pp. 2250–2267. https://doi.org/10.1109/tse.2026.3689066.

Chicago

Lin, Bo, Shangwen Wang, Liqian Chen, and Xiaoguang Mao. 2026. “Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation.” IEEE Transactions on Software Engineering 52 (8): 2250–2267. https://doi.org/10.1109/tse.2026.3689066.

Harvard

Lin, B. et al. (2026) ‘Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation’, IEEE Transactions on Software Engineering, 52(8), pp. 2250–2267. doi:10.1109/tse.2026.3689066.

IEEE

B. Lin, S. Wang, L. Chen, and X. Mao, “Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation,” IEEE Transactions on Software Engineering, vol. 52, no. 8, pp. 2250–2267, 2026, doi: 10.1109/tse.2026.3689066.

BibTeX

@article{lin2026exploring,
  title     = {{Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation}},
  author    = {Lin, Bo and Wang, Shangwen and Chen, Liqian and Mao, Xiaoguang},
  journal   = {IEEE Transactions on Software Engineering},
  year      = {2026},
  volume    = {52},
  number    = {8},
  pages     = {2250--2267},
  doi       = {10.1109/tse.2026.3689066},
  url       = {https://doi.org/10.1109/tse.2026.3689066}
}

Download for a reference manager: BibTeX (.bib) · RIS for Zotero, Mendeley and EndNote (.ris)

Topic and keywords

Physical Sciences › Computer Science › Information Systems › Software Engineering Research

  • large language models
  • code injection attacks

Work with this paper

Most-cited papers in Computer Science

All highly cited Computer Science papers

Questions about this paper

How do I cite this paper in APA style?

Lin, B., Wang, S., Chen, L., & Mao, X. (2026). Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generation. IEEE Transactions on Software Engineering, 52(8), 2250–2267. https://doi.org/10.1109/tse.2026.3689066

How many times has this paper been cited?

24 times, according to OpenAlex on 17 November 2026. Google Scholar and Scopus count different sets of sources, so their numbers differ.

Is this paper free to read?

Yes. It is open access at arXiv (Cornell University): sign in and open the PDF from this page.

Who wrote this paper?

Bo Lin, Shangwen Wang, Liqian Chen, Xiaoguang Mao.

What is the DOI of this paper?

10.1109/tse.2026.3689066, permanently at https://doi.org/10.1109/tse.2026.3689066. Sign in and open it from this page.

Bibliographic data from OpenAlex (CC0), last checked 17 November 2026. ResearchGuru does not host this paper; once you are signed in, the links open it at the publisher or the repository that does.