Security Weaknesses in LLM-Generated Source Code: An Empirical Vulnerability Analysis of Iterative AI-Assisted Development
Halil Dursunoglu, Kaan Sulkalar
SSRN Electronic Journal · 2026
Context: Large Language Models (LLMs) are increasingly integrated into software engineeringworkflows for code generation, debugging, refactoring, and feature development. While previousresearch has examined the security of one-shot code generation, the longitudinal impact of iterativeAI-assisted software refinement on software security remains insufficiently understood.
Objective: This study investigates how software vulnerabilities evolve throughout iterative AI-assisted development workflows and introduces a framework for measuring security degradationduring conversational software refinement.
Method: We propose SecureIterate, a longitudinal evaluation framework that combines promptorchestration, version tracking, static analysis, runtime validation, fuzz testing, and CWE/OWASP-based vulnerability normalization. Using 1,250 generated software versions spanning multiple pro-gramming languages, application categories, and commercial and open-source LLM families, weevaluate vulnerability propagation across repeated refinement stages. Security Drift Score (SDS) andWeighted Security Drift Score (WSDS) are introduced to quantify longitudinal security changes.
Results: The experimental results reveal statistically significant vulnerability growth throughoutiterative refinement cycles. Common weaknesses included SQL injection, improper authentication,hardcoded credentials, path traversal, insecure deserialization, and unsafe dependency usage. Cross-model analysis showed that vulnerability propagation occurred across all evaluated LLM families.Runtime validation and fuzz testing identified additional security issues not detected through staticanalysis alone. Security-aware prompting, static-analysis-guided refinement, and dependency verifi-cation reduced vulnerability growth and improved security outcomes.
Conclusion: The findings demonstrate that iterative AI-assisted software development can introducemeasurable security drift despite functional improvements. SecureIterate provides a reproducibleframework for evaluating longitudinal software security and highlights the importance of continuoussecurity validation, automated assurance mechanisms, and human oversight in AI-assisted softwareengineering workflows.