Code Vulnerability Repair with Large Language Model using Context-Aware Prompt Tuning

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Khan, Arshiya, Liu, Guannan, Gao, Xing
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915356961931264
author Khan, Arshiya
Liu, Guannan
Gao, Xing
author_facet Khan, Arshiya
Liu, Guannan
Gao, Xing
contents Large Language Models (LLMs) have shown significant challenges in detecting and repairing vulnerable code, particularly when dealing with vulnerabilities involving multiple aspects, such as variables, code flows, and code structures. In this study, we utilize GitHub Copilot as the LLM and focus on buffer overflow vulnerabilities. Our experiments reveal a notable gap in Copilot's abilities when dealing with buffer overflow vulnerabilities, with a 76% vulnerability detection rate but only a 15% vulnerability repair rate. To address this issue, we propose context-aware prompt tuning techniques designed to enhance LLM performance in repairing buffer overflow. By injecting a sequence of domain knowledge about the vulnerability, including various security and code contexts, we demonstrate that Copilot's successful repair rate increases to 63%, representing more than four times the improvement compared to repairs without domain knowledge.
format Preprint
id arxiv_https___arxiv_org_abs_2409_18395
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Code Vulnerability Repair with Large Language Model using Context-Aware Prompt Tuning
Khan, Arshiya
Liu, Guannan
Gao, Xing
Cryptography and Security
Artificial Intelligence
Large Language Models (LLMs) have shown significant challenges in detecting and repairing vulnerable code, particularly when dealing with vulnerabilities involving multiple aspects, such as variables, code flows, and code structures. In this study, we utilize GitHub Copilot as the LLM and focus on buffer overflow vulnerabilities. Our experiments reveal a notable gap in Copilot's abilities when dealing with buffer overflow vulnerabilities, with a 76% vulnerability detection rate but only a 15% vulnerability repair rate. To address this issue, we propose context-aware prompt tuning techniques designed to enhance LLM performance in repairing buffer overflow. By injecting a sequence of domain knowledge about the vulnerability, including various security and code contexts, we demonstrate that Copilot's successful repair rate increases to 63%, representing more than four times the improvement compared to repairs without domain knowledge.
title Code Vulnerability Repair with Large Language Model using Context-Aware Prompt Tuning
topic Cryptography and Security
Artificial Intelligence
url https://arxiv.org/abs/2409.18395