Skip to content
Free planNo credit card requiredStart writing

preprint · ArXiv.org · 2025

Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradox

Shivani Shukla, Himanshu Joshi, Romilla Syed

Cited by 1Open access

Abstract

The rapid adoption of Large Language Models(LLMs) for code generation has transformed software development, yet little attention has been given to how security vulnerabilities evolve through iterative LLM feedback. This paper analyzes security degradation in AI-generated code through a controlled experiment with 400 code samples across 40 rounds of "improvements" using four distinct prompting strategies. Our findings show a 37.6% increase in critical vulnerabilities after just five iterations, with distinct vulnerability patterns emerging across different prompting approaches. This evidence challenges the assumption that iterative LLM refinement improves code security and highlights the essential role of human expertise in the loop. We propose practical guidelines for developers to mitigate these risks, emphasizing the need for robust human validation between LLM iterations to prevent the paradoxical introduction of new security issues during supposedly beneficial code "improvements".

Cite this paper

APA 7

Shukla, S., Joshi, H., & Syed, R. (2025). Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradox. ArXiv.org. https://doi.org/10.48550/arxiv.2506.11022

MLA 9

Shukla, Shivani, et al. “Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradox.” ArXiv.org, 2025, https://doi.org/10.48550/arxiv.2506.11022.

Chicago

Shukla, Shivani, Himanshu Joshi, and Romilla Syed. 2025. “Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradox.” ArXiv.org. https://doi.org/10.48550/arxiv.2506.11022.

Harvard

Shukla, S., Joshi, H. and Syed, R. (2025) ‘Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradox’, ArXiv.org. Available at: https://doi.org/10.48550/arxiv.2506.11022.

BibTeX
@misc{shukla2025security,
  title = {{Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradox}},
  author = {Shukla, Shivani and Joshi, Himanshu and Syed, Romilla},
  journal = {ArXiv.org},
  year = {2025},
  doi = {10.48550/arxiv.2506.11022}
}

Made from the index record. Check names, capitalisation and page numbers against the paper. Need another style? AI for Research has over 10,000.