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

Shivani Shukla, Himanshu Joshi, Romilla Syed
5/19/2025
cs.SEcs.AIcs.CL

No confident code implementation found for this paper.

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".

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{shukla2025security,
  title  = {Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradox},
  author = {Shivani Shukla and Himanshu Joshi and Romilla Syed},
  year   = {2025},
  eprint = {2506.11022},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.11022v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.11022.svg)](https://codeofpaper.com/paper/2506.11022)

Discussion