STEMM Institute Press
Science, Technology, Engineering, Management and Medicine
Research on Security Risk Analysis and Coping Strategies of AI Generated Code
DOI: https://doi.org/10.62517/jike.202604409
Author(s)
Yanwen Zhang
Affiliation(s)
School of Information Technology and Engineering, Guangzhou College of Commerce, Guangzhou, Guangdong, China
Abstract
The widespread adoption of AI coding assistants such as ChatGPT and GitHub Copilot has transformed software development. However, the code they generate frequently harbors critical security vulnerabilities including SQL injection, cross-site scripting (XSS), and buffer overflow. This paper systematically reviews recent research and industry reports on the security risks of AI-generated code, and proposes a four-dimensional analytical framework encompassing code vulnerabilities, code quality, supply chain security, and developer cognition. Analysis reveals significant interactions among these dimensions: developer cognitive biases may exacerbate vulnerability risks, supply chain contamination degrades code quality, while robust security practices can partially mitigate these adverse impacts. Accordingly, this paper proposes multi-layered mitigation strategies covering technical detection, process management, developer training, and organizational governance, providing actionable guidance for secure software development in the AI-assisted paradigm.
Keywords
AI Coding Assistants; Code Security; Large Language Models; Vulnerability Detection; Software Security
References
[1] Stack Overflow. 2025 Developer Survey: AI. https://survey.stackoverflow.co/2025/ai, 2025. [2] Ji J, Jun J, Wu M, et al. Cybersecurity risks of AI-generated code. Center for Security and Emerging Technology (CSET), Georgetown University, 2024. https://cset. georgetown.edu/publication/cybersecurity-risks-of-ai-generated-code/. [3] OWASP Foundation. OWASP Top 10 for LLM Applications 2025. (2024-11-18)[2026-08-13]. https://genai.owasp.org/ resource/owasp-top-10-for-llm-applications-2025/. [4] National Institute of Standards and Technology. Secure Software Development Framework (SSDF) Version 1.1: Recommendations for Mitigating the Risk of Software Vulnerabilities. NIST Special Publication 800-218, 2022. [5] National Institute of Standards and Technology. Artificial Intelligence Risk Management Framework (AI RMF 1.0). NIST AI 100-1, 2023. [6] Negri-Ribalta C, Geraud-Stewart R, Lenzini G. A systematic literature review on the impact of AI models on the security of code generation. Frontiers in Big Data, 2024, 7: 1386720. [7] Chen Y, Sun W, Fang C, et al. Security of language models for code: A systematic literature review. ACM Transactions on Software Engineering and Methodology, 2025, 35(7): 1-42. [8] Hou X, Zhao Y, Liu Y, et al. Large language models for software engineering: A systematic literature review. ACM Transactions on Software Engineering and Methodology, 2024, 33(8): 220:1-220:79. [9] Veracode. 2025 GenAI code security report. Veracode, 2025. [10] Hendrycks D, Basart S, Kadavath S, et al. Measuring coding challenge competence with APPS. Advances in Neural Information Processing Systems (NeurIPS), 2021, 34: 24018-24030. [11] Pearce H, Ahmad B, Tan B, et al. Asleep at the keyboard? Assessing the security of GitHub Copilot's code contributions. 2022 IEEE Symposium on Security and Privacy (SP). IEEE, 2022: 980-997. [12] Perry N, Srivastava M, Kumar D, et al. Do users write more insecure code with AI assistants?. Proceedings of the 2023 ACM SIGSAC Conference on Computer and Communications Security (CCS '23). ACM, 2023: 2255-2269. [13] Fu Y, Liang P, Tahir A, et al. Security weaknesses of Copilot-generated code in GitHub projects: An empirical study. ACM Transactions on Software Engineering and Methodology, 2025, 34(1): 1-31. [14] MITRE. CWE Top 25 Most Dangerous Software Weaknesses 2025. (2025-12-16)[2026-08-13]. https://cwe.mitre.org/top 25/. [15] Liu Z, Tang Y, Luo X, et al. No need to lift a finger anymore? Assessing the quality of code generation by ChatGPT. IEEE Transactions on Software Engineering, 2024, 50(6): 1504-1538. [16] Gasiba T, Iosif A-C, Kessba I, et al. May the source be with you: On ChatGPT, cybersecurity, and secure coding. Information, 2024, 15(9): 572. [17] Spracklen J, Jadliwala M S, Raval A, et al. We have a package for you! A comprehensive analysis of package hallucinations by code generating LLMs. Proceedings of the 34th USENIX Security Symposium (USENIX Security '25). USENIX Association, 2025. [18] Snyk. State of AI-generated code security. Snyk, 2023. https://snyk.io/state-of-ai-generated-code-security/.
Copyright @ 2020-2035 STEMM Institute Press All Rights Reserved