T-RAP: A Template-guided Retrieval-Augmented Vulnerability Patch Generation Approach
Open Access
- 24 July 2024
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 105-114
Abstract
Vulnerabilities exert great burden on developers in terms of debugging and maintenance. Automated Vulnerability Repair(AVR) is considered as a promising approach to alleviate the burden of developers. Template-based automated program repair techniques have shown their effectiveness in fixing general bugs. However, due to the diverse root causes of vulnerabilities, it is challenging to construct sufficient repair templates to cover various vulnerabilities. In this paper, we introduce a Template-guided Retrieval-Augmented Patch generation approach, named T-RAP. Inspired by retrieval-augmented techniques that effectively utilize historical data, our approach leverages repair templates to extract similar vulnerability repair patches from the codebase. These patches then guide the process of generating vulnerability patches. To extract similar patches, we also propose a matching algorithm specifically designed for the retrieval-augmented vulnerability repair. This involves identifying similarities between numerous templates and vulnerabilities during the template-guided stage. Experimental results demonstrate that T-RAP outperforms all the studied AVR approaches, repairing 56.8% more vulnerabilities than VulRepair and 30.24% more than VulMaster. It can also accurately repair more types of real-world vulnerabilities than VulMaster. Additionally, we evaluated the effectiveness of our patch retriever. The results indicate that our template-guided retriever, which is based on our matching algorithm, outperforms the retrieval algorithm proposed in the recent retrieval-augmented patch generation approach RAP-Gen.Keywords
This publication has 30 references indexed in Scilit:
- Fusing Code SearchersIEEE Transactions on Software Engineering, 2024
- Data Quality for Software Vulnerability Datasets2023
- SeqTrans: Automatic Vulnerability Fix Via Sequence to Sequence LearningIEEE Transactions on Software Engineering, 2022
- Neural Transfer Learning for Repairing Security Vulnerabilities in C CodeIEEE Transactions on Software Engineering, 2022
- FixMiner: Mining relevant fix patterns for automated program repairEmpirical Software Engineering, 2020
- IntRepair: Informed Repairing of Integer OverflowsIEEE Transactions on Software Engineering, 2019
- Using Safety Properties to Generate Vulnerability Patches2019
- VFix: Value-Flow-Guided Precise Program Repair for Null Pointer Dereferences2019
- Automatic Software Repair: A SurveyIEEE Transactions on Software Engineering, 2017
- Fine-grained and accurate source code differencing2014