Leveraging Static Analysis for Feedback-Driven Security Patching in LLM-Generated Code
Large language models (LLMs) have shown remarkable potential for automatic code generation. Yet, these models share a weakness with their human counterparts: inadvertently generating code with security vulnerabilities that could allow unauthorized attackers to access sensitive data or systems. In this work, we propose Feedback-Driven Security Patching (FDSP), wherein LLMs automatically refine vulnerable generated code. The key to our approach is a unique framework that leverages automatic static code analysis to enable the LLM to create and implement potential solutions to code vulnerabilities. Further, we curate a novel benchmark, PythonSecurityEval, that can accelerate progress in the field of code generation by covering diverse, real-world applications, including databases, websites, and operating systems. Our proposed FDSP approach achieves the strongest improvements, reducing vulnerabilities by up to 33% when evaluated with Bandit and 12% with CodeQL and outperforming baseline refinement methods.
Authors
- Matthew Gombolay (ORCID: https://orcid.org/0000-0002-5321-6038)
- Abdullah Aljasser (ORCID: https://orcid.org/0000-0003-1039-1730)
- Pradyumna Tambwekar (ORCID: https://orcid.org/0000-0003-2931-2502)
- Kamel Alrashedy
Institutions
- Georgia Institute of Technology (US)
Publication Details
- Journal
- Journal of Cybersecurity and Privacy
- Published
- 2025-12-05
- DOI
- https://doi.org/10.3390/jcp5040110
- Primary Topic
- Advanced Malware Detection Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- Saudi Arabian Cultural Mission