VQR: Automated Software Vulnerability Repair Through Vulnerability Queries

Michael Fu, Van Nguyen, Chakkrit Tantithamthavorn, Trung Le, Dinh PhungICLR 2023 · OpenReview

Abstract

Recently, automated vulnerability repair (AVR) approaches have been widely adopted to combat the increasing number of software security issues. In particular, transformer-based models achieve competitive results. While existing models are learned to generate vulnerability repairs, existing AVR models lack a mechanism to provide their models with the precise location of vulnerable code (i.e., models may generate repairs for the non-vulnerable areas). To address this problem, we base our framework on the VIT-based approaches for object detection that learn to locate bounding boxes via the cross-matching between object queries and image patches. We cross-match vulnerability queries and their corresponding vulnerable code areas through the cross-attention mechanism to generate more accurate repairs. To strengthen our cross-matching, we propose to learn a novel vulnerability query mask that greatly focuses on vulnerable code areas and integrate it into the cross-attention. Moreover, we also incorporate the vulnerability query mask into the self-attention to learn embeddings that emphasize the vulnerable areas of a program. Through an extensive evaluation using the real-world 5,417 vulnerabilities, our approach outperforms all of the baseline methods by 3.39%-33.21%. The training code and pre-trained models are available at https://github.com/AVR-VQR/VQR.
BibTeX
@inproceedings{fu2023vqr,
  author = {Michael Fu and Van Nguyen and Chakkrit Tantithamthavorn and Trung Le and Dinh Phung},
  title = {{VQR: Automated Software Vulnerability Repair Through Vulnerability Queries}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=YKoRmMhcpWk},
}

Loading related content...

Figure