Static Analysis-Guided Patch Synthesis for Correcting LLM-Generated Insecure Code
Abstract
Abstract LLMs often miss subtle security conditions such as boundary checks and authentication flows. We introduce a static-analysis-driven patch synthesizer that transforms insecure LLM output into correct and safe code. The pipeline uses abstract interpretation to detect violations, followed by SMT-guided repair rules. On 3,200 vulnerable code snippets across five vulnerability categories, our system achieves 74% full automatic repair and 92% partial repair, outperforming Codex and GPT-4 post-processing by a large margin. Developer usability evaluation shows 58% reduction in manual fix time. The method highlights how program analysis can systematically strengthen LLM-based secure coding.
Fields of Study & Subjects
Software Testing and Debugging Techniques
Software Engineering Research
Security and Verification in Computing
Publication details
- Journal / source
- Research Square
- Publication date
- 3 March 2026
- Language
- EN
- Document type
- Preprint