mlsanityData to 14 Oct 2026

How Safe Are AI-Generated Patches? A Large-scale Study on Security Risks in LLM and Agentic Automated Program Repair on SWE-bench

arXiv 2507.02976 ↗First posted 30 Jun 2025cs.CR cs.LG cs.SEcited by 5

On the map: LLM agents and tool use → Agent threats, guardrails and governance

Abstract (arXiv)

Large language models (LLMs) and their agentic frameworks are increasingly adopted to perform development tasks such as automated program repair (APR). While prior work has identified security risks in LLM-generated code, most have focused on synthetic, simplified, or isolated tasks that lack the complexity of real-world program repair. In this study, we present the first large-scale security analysis of LLM-generated patches using 20,000+ GitHub issues. We evaluate patches proposed by developers, a standalone LLM (Llama 3.3 Instruct-70B), and three top-performing agentic frameworks (OpenHands, AutoCodeRover, HoneyComb). Finally, we analyze a wide range of code, issue, and project-level factors to understand the conditions under which generating insecure patches is more likely. Our findings reveal that Llama introduces many new vulnerabilities, exhibiting unique patterns not found in developers' code. Agentic workflows also generate a number of vulnerabilities, particularly when given more autonomy. We find that vulnerabilities in LLM-generated patches are associated with distinctive code characteristics and are commonly observed in issues missing specific types of information. These results suggest that contextual factors play a critical role in the security of the generated patches and point toward the need for proactive risk assessment methods that account for both issue and code-level information.

Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 33 of its 85 references that are in the map. First posted on arXiv 30 Jun 2025.

Builds on

33 of 85 references.

References · 33

  1. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
  2. 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineeringcited by 1,737
  3. 2024Chatbot Arena: An Open Platform for Evaluating LLMs by Human Preferencecited by 1,184
  4. 2024OpenHands: An Open Platform for AI Software Developers as Generalist Agentscited by 1,002
  5. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  6. 2022Do Users Write More Insecure Code with AI Assistants?cited by 192
  7. 2020Deep Learning based Vulnerability Detection: Are We There Yet?cited by 144
  8. 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 107
  9. 2024IRIS: LLM-Assisted Static Analysis for Detecting Security Vulnerabilitiescited by 103
  10. 2023LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarkscited by 97
  11. 2023How Secure is Code Generated by ChatGPT?cited by 81
  12. 2023Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issuescited by 79
21 more
  1. 2024Automated Unit Test Improvement using Large Language Models at Metacited by 75
  2. 2023Using Large Language Models to Generate JUnit Tests: An Empirical Studycited by 53
  3. 2025Are "Solved Issues" in SWE-bench Really Solved Correctly? An Empirical Studycited by 49
  4. 2025LLMs in Software Security: A Survey of Vulnerability Detection Techniques and Insightscited by 47
  5. 2023Is Stack Overflow Obsolete? An Empirical Study of the Characteristics of ChatGPT Answers to Stack Overflow Questionscited by 42
  6. 2023SALLM: Security Assessment of Generated Codecited by 39
  7. 2022CCTEST: Testing and Repairing Code Completion Systemscited by 35
  8. 2024Toward Secure Code Generation: Bridging Correctness and Security via Task-Adaptive Vulnerability Modeling and Execution-Based Benchmarkingcited by 27
  9. 2025Enhancing repository-level software repair via repository-aware knowledge graphscited by 27
  10. 2024LLMs in Web Development: Evaluating LLM-Generated PHP Code Unveiling Vulnerabilities and Limitationscited by 22
  11. 2023How Can ChatGPT Support Human Security Testers to Help Mitigate Supply Chain Attacks?cited by 20
  12. 2024Comparison of Static Application Security Testing Tools and Large Language Models for Repo-level Vulnerability Detectioncited by 18
  13. 2024An Empirical Study of Static Analysis Tools for Secure Code Reviewcited by 17
  14. 2023Harnessing the Power of LLM to Support Binary Taint Analysiscited by 13
  15. 2024Just another copy and paste? Comparing the security vulnerabilities of ChatGPT generated code and StackOverflow answerscited by 13
  16. 2021A Critical Comparison on Six Static Analysis Tools: Detection, Agreement, and Precisioncited by 9
  17. 2024Enhancing Automated Program Repair with Solution Designcited by 8
  18. 2025The Art of Repair: Optimizing Iterative Program Repair with Instruction-Tuned Modelscited by 7
  19. 2021Anomalicious: Automated Detection of Anomalous and Potentially Malicious Commits on GitHubcited by 4
  20. 2025The Hitchhiker's Guide to Program Analysis, Part II: Deep Thoughts by LLMscited by 4
  21. 2025Do Prompt Patterns Affect Code Quality? A First Empirical Assessment of ChatGPT-Generated Codecited by 4

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 5.

5 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025From LLMs to Agents: A Comparative Evaluation of LLMs and LLM-based Agents in Security Patch Detection
  2. 2024AutoSafeCoder: A Multi-Agent Framework for Securing LLM Code Generation through Static Analysis and Fuzz Testing
  3. 2025LLM Agents for Automated Web Vulnerability Reproduction: Are We There Yet?
  4. 2026RAVEN: Agentic RAG for Automated Vulnerability Repair
  5. 2025Red Teaming Program Repair Agents: When Correct Patches can Hide Vulnerabilities
  6. 2025SEC-bench: Automated Benchmarking of LLM Agents on Real-World Software Security Tasks
  7. 2026When Passing Tests Hides Vulnerabilities: An Empirical Study of Silent Failures in Agentic Systems
  8. 2025Application Modernization with LLMs: Addressing Core Challenges in Reliability, Security, and Quality