A Survey on Large Language Models in Software Security: Opportunities and Threats
Authors:
- Bajlur RashidBRBajlur Rashid
- Mohammad Shafayet Jamil HossainMHMohammad Shafayet Jamil Hossain
- Mohammad Ishtiaque KhanMohammad Ishtiaque Khan
- Sharaban TahoraSTSharaban Tahora
- Aiasha SiddikaASAiasha Siddika
- Mahmudul Islam PrakashMPMahmudul Islam Prakash
- Sharmin YeasminSYSharmin Yeasmin
- Hossain ShahriarHossain Shahriar
Open Access
Abstract
The rise of large language models (LLMs), such as GPT-4, Codex, Code Llama, Claude 3, CodeGemma and DeepSeek, etc., is changing the way software development is approached. These models provide strong support for tasks like writing codes, analyzing bugs, and automation. At the same time, their use in software development creates both opportunities and new risks. This survey reviews how LLMs are being used to improve security practices in software development, including vulnerability detection, secure code generation, threat analysis, and patch development. It also discusses how attackers may exploit LLMs for malicious purposes, such as writing malware, carrying out phishing campaigns, or bypassing defenses. We draw on case studies that show LLMs can help uncover zero-day vulnerabilities and speed up secure coding but also highlight cases where they have been misused to generate harmful code, sometimes unintentionally. The paper examines technical challenges like bias in training data, the difficulty of interpreting model outputs, and the risks of adversarial attacks. It also considers ethical and regulatory issues related to accountability, compliance, and responsible use. By bringing together findings from recent research and industry practice, the survey outlines future directions for building safer models, developing stronger defensive frameworks, and shaping policies that balance innovation with security. Overall, the paper argues for a careful approach where LLMs are used to strengthen software security while addressing the risks they introduce through collaboration, oversight, and ongoing improvements.Keywords
Funding Information
- National Science Foundation (2433800 (ML4CS))
- National Science Foundation (2421324 (ALAMOSE))
- National Science Foundation (1946442 (ACES))
- National Institutes of Health (5R42LM014356-03)
This publication has 64 references indexed in Scilit:
- Correctness assessment of code generated by Large Language Models using internal representationsJournal of Systems and Software, 2025
- Bugs in large language models generated code: an empirical studyEmpirical Software Engineering, 2025
- How secure is AI-generated code: a large-scale comparison of large language modelsEmpirical Software Engineering, 2024
- LLMs in Web Development: Evaluating LLM-Generated PHP Code Unveiling Vulnerabilities and Limitations2024
- Large language models (LLMs): survey, technical frameworks, and future challengesArtificial Intelligence Review, 2024
- Automating the correctness assessment of AI-generated code for security contextsJournal of Systems and Software, 2024
- A survey on large language model (LLM) security and privacy: The Good, The Bad, and The UglyHigh-Confidence Computing, 2024
- Auditing large language models: a three-layered approachAI and Ethics, 2023
- Explainability of artificial intelligence methods, applications and challenges: A comprehensive surveyInformation Sciences, 2022
- Explainable Artificial Intelligence (XAI): Concepts, taxonomies, opportunities and challenges toward responsible AIInformation Fusion, 2020