mlsanityData to 14 Oct 2026

Do LLMs Consider Security? An Empirical Study on Responses to Programming Questions

arXiv 2502.14202 ↗First posted 20 Feb 2025cs.SE cs.AI cs.CLcited by 9

Not on the map. Why?

Abstract (arXiv)

The widespread adoption of conversational LLMs for software development has raised new security concerns regarding the safety of LLM-generated content. Our motivational study outlines ChatGPT's potential in volunteering context-specific information to the developers, promoting safe coding practices. Motivated by this finding, we conduct a study to evaluate the degree of security awareness exhibited by three prominent LLMs: Claude 3, GPT-4, and Llama 3. We prompt these LLMs with Stack Overflow questions that contain vulnerable code to evaluate whether they merely provide answers to the questions or if they also warn users about the insecure code, thereby demonstrating a degree of security awareness. Further, we assess whether LLM responses provide information about the causes, exploits, and the potential fixes of the vulnerability, to help raise users' awareness. Our findings show that all three models struggle to accurately detect and warn users about vulnerabilities, achieving a detection rate of only 12.6% to 40% across our datasets. We also observe that the LLMs tend to identify certain types of vulnerabilities related to sensitive information exposure and improper input neutralization much more frequently than other types, such as those involving external control of file names or paths. Furthermore, when LLMs do issue security warnings, they often provide more information on the causes, exploits, and fixes of vulnerabilities compared to Stack Overflow responses. Finally, we provide an in-depth discussion on the implications of our findings and present a CLI-based prompting tool that can be used to generate significantly more secure LLM responses.

Key facts. Cited by 9 papers in the map (data through 14 Oct 2026). Builds on 35 of its 83 references that are in the map. First posted on arXiv 20 Feb 2025.

Builds on

35 of 83 references.

References · 35

  1. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  2. 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 399
  3. 2023A Survey on Large Language Model (LLM) Security and Privacy: The Good, the Bad, and the Uglycited by 387
  4. 2023Using an LLM to Help With Code Understandingcited by 228
  5. 2022Do Users Write More Insecure Code with AI Assistants?cited by 192
  6. 2023LLM Lies: Hallucinations are not Bugs, but Features as Adversarial Examplescited by 177
  7. 2023InferFix: End-to-End Program Repair with LLMscited by 114
  8. 2023LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarkscited by 97
  9. 2023Getting pwn'd by AI: Penetration Testing with Large Language Modelscited by 83
  10. 2023How Secure is Code Generated by ChatGPT?cited by 81
  11. 2023Towards an Understanding of Large Language Models in Software Engineering Taskscited by 68
  12. 2022Is GitHub's Copilot as Bad as Humans at Introducing Vulnerabilities in Code?cited by 67
23 more
  1. 2022NatGen: Generative pre-training by "Naturalizing" source codecited by 54
  2. 2023Using Large Language Models to Generate JUnit Tests: An Empirical Studycited by 53
  3. 2024Large Language Model for Vulnerability Detection: Emerging Results and Future Directionscited by 45
  4. 2023Is Stack Overflow Obsolete? An Empirical Study of the Characteristics of ChatGPT Answers to Stack Overflow Questionscited by 42
  5. 2022Transformer-Based Language Models for Software Vulnerability Detectioncited by 39
  6. 2023Evaluation of ChatGPT Model for Vulnerability Detectioncited by 33
  7. 2023Can GPT-4 Support Analysis of Textual Data in Tasks Requiring Highly Specialized Domain Expertise?cited by 31
  8. 2023Decoding the Threat Landscape : ChatGPT, FraudGPT, and WormGPT in Social Engineering Attackscited by 23
  9. 2023How Can ChatGPT Support Human Security Testers to Help Mitigate Supply Chain Attacks?cited by 20
  10. 2023Can Large Language Models Find And Fix Vulnerable Software?cited by 15
  11. 2023DefectHunter: A Novel LLM-Driven Boosted-Conformer-based Code Vulnerability Detection Mechanismcited by 14
  12. 2017Stack Overflow Considered Harmful? The Impact of Copy&Paste on Android Application Securitycited by 12
  13. 2023DevGPT: Studying Developer-ChatGPT Conversationscited by 12
  14. 2024Are Large Language Models Memorizing Bug Benchmarks?cited by 12
  15. 2024Software Vulnerability and Functionality Assessment using LLMscited by 11
  16. 2023Conversational Challenges in AI-Powered Data Science: Obstacles, Needs, and Design Opportunitiescited by 9
  17. 2024An Empirical Study on Developers Shared Conversations with ChatGPT in GitHub Pull Requests and Issuescited by 9
  18. 2023Using ChatGPT as a Static Application Security Testing Toolcited by 8
  19. 2018Recommending Insightful Comments for Source Code using Crowdsourced Knowledgecited by 4
  20. 2023Evaluating Privacy Questions From Stack Overflow: Can ChatGPT Compete?cited by 2
  21. 2022Using clarification questions to improve software developers' Web searchcited by 1
  22. 2023Which is a better programming assistant? A comparative study between chatgpt and stack overflowcited by 1
  23. 2024Investigating the Utility of ChatGPT in the Issue Tracking System: An Exploratory Studycited by 1

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 4; 2026: 5.

9 papers.