SPVR: syntax-to-prompt vulnerability repair based on large language models
Ruoke Wang, Zongjie Li, Cuiyun Gao, Chaozheng Wang, Yang Xiao, Xuan Wang

TL;DR
SPVR is a novel framework that improves vulnerability repair by extracting syntax-based prompts from code, enabling large language models to generate more accurate patches for vulnerable code.
Contribution
The paper introduces SPVR, a syntax-to-prompt framework that leverages syntax trees and CWE descriptions to enhance LLM-based vulnerability repair accuracy.
Findings
Successfully repaired 143 out of 547 vulnerable codes with ChatGPT-4.
Outperformed existing approaches in multiple evaluation metrics.
Demonstrated the effectiveness of syntax-based prompts in vulnerability repair.
Abstract
Purpose: In the field of vulnerability repair, previous research has leveraged pretrained models and LLM-based prompt engineering, among which LLM-based approaches show better generalizability and achieve the best performance. However, the LLM-based approaches generally regard vulnerability repair as a sequence-to-sequence task, and do not explicitly capture the syntax patterns for different vulnerability types, leading to limited accuracy. We aim to create a method that ensures the specificity of prompts targeting vulnerable code while also leveraging the generative capabilities of Large Language Models. Methods: We propose SPVR (Syntax-to-Prompt Vulnerability Repair), a novel framework that collects information from syntax trees, and generates corresponding prompts. Our method consists of three steps: rule design, prompt generation, and patch generation. In the rule design step, our…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
