Papers
arxiv:2409.00571

Enhancing Source Code Security with LLMs: Demystifying The Challenges and Generating Reliable Repairs

Published on Sep 1, 2024
Authors:
,
,
,
,

Abstract

An instruction-based large language model system, SecRepair, identifies, describes, and automatically repairs vulnerable source code, using reinforcement learning fine-tuning with a semantic reward to improve security repair quality.

With the recent unprecedented advancements in Artificial Intelligence (AI) computing, progress in Large Language Models (LLMs) is accelerating rapidly, presenting challenges in establishing clear guidelines, particularly in the field of security. That being said, we thoroughly identify and describe three main technical challenges in the security and software engineering literature that spans the entire LLM workflow, namely; \textit{(i)} Data Collection and Labeling; \textit{(ii)} System Design and Learning; and \textit{(iii)} Performance Evaluation. Building upon these challenges, this paper introduces SecRepair, an instruction-based LLM system designed to reliably identify, describe, and automatically repair vulnerable source code. Our system is accompanied by a list of actionable guides on \textit{(i)} Data Preparation and Augmentation Techniques; \textit{(ii)} Selecting and Adapting state-of-the-art LLM Models; \textit{(iii)} Evaluation Procedures. SecRepair uses a reinforcement learning-based fine-tuning with a semantic reward that caters to the functionality and security aspects of the generated code. Our empirical analysis shows that SecRepair achieves a 12\% improvement in security code repair compared to other LLMs when trained using reinforcement learning. Furthermore, we demonstrate the capabilities of SecRepair in generating reliable, functional, and compilable security code repairs against real-world test cases using automated evaluation metrics.

Community

Sign up or log in to comment

Models citing this paper 0

No model linking this paper

Cite arxiv.org/abs/2409.00571 in a model README.md to link it from this page.

Datasets citing this paper 0

No dataset linking this paper

Cite arxiv.org/abs/2409.00571 in a dataset README.md to link it from this page.

Spaces citing this paper 0

No Space linking this paper

Cite arxiv.org/abs/2409.00571 in a Space README.md to link it from this page.

Collections including this paper 0

No Collection including this paper

Add this paper to a collection to link it from this page.