arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.14752cs.SEcs.AIcs.FLcs.LG
收藏

软件安全的新纪元:通过大语言模型与形式化验证迈向自修复软件

A New Era in Software Security: Towards Self-Healing Software via Large Language Models and Formal Verification

Technology Innovation Institute (TII)(技术创新研究所(TII));University of Manchester(曼彻斯特大学)

Norbert Tihanyi, Ridhi Jain, Yiannis Charalambous, Mohamed Amine Ferrag, Youcheng Sun, Lucas C. Cordeiro

AI总结:

本文提出ESBMC-AI框架,将大语言模型与有界模型检测相结合,自动检测并修复C程序中的缓冲区溢出、算术溢出等漏洞,并在50,000个C程序上验证了其高精度修复能力。

摘要:

本文提出了一种创新方法,将大语言模型(LLMs)与形式化验证策略相结合,用于软件漏洞的自动修复。首先,我们采用有界模型检测(BMC)来识别漏洞并提取反例。这些反例由数学证明和漏洞的堆栈跟踪提供支持。通过使用专门设计的提示,我们将原始源代码与已识别的漏洞信息(包括其堆栈跟踪以及指明行号和错误类型的反例)相结合。随后,将这些组合信息输入到大语言模型中,并指示其尝试修复代码。修复后的新代码会再次使用BMC进行验证,以确保修复成功。我们提出了ESBMC-AI框架作为概念验证,该框架利用了广受认可且被业界采用的基于SMT的高效上下文有界模型检测器(ESBMC)以及一个预训练的Transformer模型,来检测和修复C程序中的错误,尤其是在关键软件组件中。我们在从FormAI数据集中随机选取的50,000个C程序上评估了我们的方法,这些程序带有各自的漏洞分类。结果表明,ESBMC-AI能够高精度地自动检测和修复诸如缓冲区溢出、算术溢出和指针解引用失败等问题。ESBMC-AI是一项开创性的工作,它将大语言模型与BMC技术集成在一起,为在软件开发生命周期中的持续集成与持续部署(CI/CD)流程中的潜在集成提供了可能。

英文摘要:

This paper introduces an innovative approach that combines Large Language Models (LLMs) with Formal Verification strategies for automatic software vulnerability repair. Initially, we employ Bounded Model Checking (BMC) to identify vulnerabilities and extract counterexamples. These counterexamples are supported by mathematical proofs and the stack trace of the vulnerabilities. Using a specially designed prompt, we combine the original source code with the identified vulnerability, including its stack trace and counterexample that specifies the line number and error type. This combined information is then fed into an LLM, which is instructed to attempt to fix the code. The new code is subsequently verified again using BMC to ensure the fix succeeded. We present the ESBMC-AI framework as a proof of concept, leveraging the well-recognized and industry-adopted Efficient SMT-based Context-Bounded Model Checker (ESBMC) and a pre-trained transformer model to detect and fix errors in C programs, particularly in critical software components. We evaluated our approach on 50,000 C programs randomly selected from the FormAI dataset with their respective vulnerability classifications. Our results demonstrate ESBMC-AI's capability to automate the detection and repair of issues such as buffer overflow, arithmetic overflow, and pointer dereference failures with high accuracy. ESBMC-AI is a pioneering initiative, integrating LLMs with BMC techniques, offering potential integration into the continuous integration and deployment (CI/CD) process within the software development lifecycle.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑