Enhancing Reverse Engineering: Investigating and Benchmarking Large Language Models for Vulnerability Analysis in Decompiled Binaries
作者: Dylan Manuel, Nafis Tanveer Islam, Joseph Khoury, Ana Nunez, Elias Bou-Harb, Peyman Najafirad
分类: cs.CR, cs.AI
发布日期: 2024-11-07
💡 一句话要点
提出DeBinVul数据集,提升LLM在反编译二进制代码漏洞分析中的性能
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 反编译二进制代码 漏洞分析 大型语言模型 数据集构建 软件安全
📋 核心要点
- 现有LLM在分析反编译二进制代码漏洞时存在语义局限性,缺乏相关数据集是主要挑战。
- 论文提出DeBinVul数据集,包含多架构、多优化的C/C++反编译二进制代码样本,用于漏洞分析。
- 实验表明,使用DeBinVul微调后,CodeLlama、Llama3和CodeGen2在漏洞检测能力上分别提升了19%、24%和21%。
📝 摘要(中文)
安全专家通过反编译二进制代码来识别关键安全漏洞。由于关键基础设施(CI)中的固件、驱动程序和专有软件等重要系统对源代码的访问受限,二进制级别的分析至关重要。即使有源代码,编译后源代码和处理器执行的二进制代码之间仍然存在语义差距,这可能会阻碍源代码中漏洞的检测。目前,大型语言模型(LLM)的研究主要集中在源代码上,忽略了反编译二进制文件的重要性。本文首次实证揭示了现有LLM在分析反编译二进制文件中的漏洞时存在显著的语义局限性,这主要是由于缺乏相关数据集。为了弥合这一差距,我们引入了DeBinVul,这是一个新的反编译二进制代码漏洞数据集。我们的数据集是多架构和多优化的,侧重于C/C++,因为它们在CI中被广泛使用,并且与大量漏洞相关联。具体来说,我们为反编译二进制文件领域中的(i)识别;(ii)分类;(iii)描述漏洞;以及(iv)恢复函数名称的任务,整理了150,872个易受攻击和不易受攻击的反编译二进制代码样本。随后,我们使用DeBinVul对最先进的LLM进行微调,并报告了CodeLlama、Llama3和CodeGen2在检测二进制代码漏洞方面的能力分别提高了19%、24%和21%。此外,使用DeBinVul,我们在漏洞分类任务中报告了80-90%的高性能。此外,我们报告了函数名称恢复和漏洞描述任务的性能有所提高。
🔬 方法详解
问题定义:现有的大型语言模型(LLM)在漏洞分析领域的研究主要集中在源代码上,忽略了反编译二进制代码的重要性。由于缺乏针对反编译二进制代码漏洞分析的专门数据集,现有的LLM在处理此类任务时表现出显著的语义局限性,无法有效识别、分类和描述二进制代码中的漏洞。
核心思路:论文的核心思路是通过构建一个大规模、多架构、多优化的反编译二进制代码漏洞数据集(DeBinVul),来弥补现有LLM在二进制代码漏洞分析方面的不足。通过使用DeBinVul对LLM进行微调,可以显著提升其在二进制代码漏洞检测、分类、描述和函数名恢复等任务上的性能。
技术框架:该研究的技术框架主要包括以下几个阶段:1) 数据集构建:收集并整理包含漏洞和非漏洞的反编译二进制代码样本,涵盖多种架构和优化级别。2) 模型微调:使用DeBinVul数据集对现有的LLM(如CodeLlama、Llama3和CodeGen2)进行微调,使其适应二进制代码漏洞分析任务。3) 性能评估:在漏洞检测、分类、描述和函数名恢复等任务上评估微调后的LLM的性能,并与未微调的模型进行比较。
关键创新:该论文最重要的技术创新点在于DeBinVul数据集的构建。该数据集是首个专门针对反编译二进制代码漏洞分析的大规模数据集,具有多架构、多优化级别的特点,能够有效提升LLM在二进制代码漏洞分析方面的性能。与现有方法相比,该方法不再局限于源代码分析,而是直接针对二进制代码进行分析,更贴近实际应用场景。
关键设计:DeBinVul数据集包含150,872个C/C++反编译二进制代码样本,涵盖多种架构(未知)和优化级别(未知)。数据集被用于微调CodeLlama、Llama3和CodeGen2等LLM。性能评估指标包括漏洞检测准确率、漏洞分类准确率、函数名恢复准确率和漏洞描述的质量(未知,未给出具体评估指标)。
🖼️ 关键图片
📊 实验亮点
实验结果表明,使用DeBinVul数据集对LLM进行微调后,在二进制代码漏洞检测任务中,CodeLlama、Llama3和CodeGen2的性能分别提升了19%、24%和21%。此外,在漏洞分类任务中,微调后的模型达到了80-90%的准确率。这些结果表明DeBinVul数据集能够有效提升LLM在二进制代码漏洞分析方面的能力。
🎯 应用场景
该研究成果可应用于软件安全领域,帮助安全专家更有效地识别和修复二进制代码中的漏洞。尤其是在关键基础设施、嵌入式系统和逆向工程等领域,该方法能够提升安全分析的效率和准确性,降低安全风险。未来,该研究可以扩展到更多编程语言和架构,进一步提升二进制代码安全分析的能力。
📄 摘要(原文)
Security experts reverse engineer (decompile) binary code to identify critical security vulnerabilities. The limited access to source code in vital systems - such as firmware, drivers, and proprietary software used in Critical Infrastructures (CI) - makes this analysis even more crucial on the binary level. Even with available source code, a semantic gap persists after compilation between the source and the binary code executed by the processor. This gap may hinder the detection of vulnerabilities in source code. That being said, current research on Large Language Models (LLMs) overlooks the significance of decompiled binaries in this area by focusing solely on source code. In this work, we are the first to empirically uncover the substantial semantic limitations of state-of-the-art LLMs when it comes to analyzing vulnerabilities in decompiled binaries, largely due to the absence of relevant datasets. To bridge the gap, we introduce DeBinVul, a novel decompiled binary code vulnerability dataset. Our dataset is multi-architecture and multi-optimization, focusing on C/C++ due to their wide usage in CI and association with numerous vulnerabilities. Specifically, we curate 150,872 samples of vulnerable and non-vulnerable decompiled binary code for the task of (i) identifying; (ii) classifying; (iii) describing vulnerabilities; and (iv) recovering function names in the domain of decompiled binaries. Subsequently, we fine-tune state-of-the-art LLMs using DeBinVul and report on a performance increase of 19%, 24%, and 21% in the capabilities of CodeLlama, Llama3, and CodeGen2 respectively, in detecting binary code vulnerabilities. Additionally, using DeBinVul, we report a high performance of 80-90% on the vulnerability classification task. Furthermore, we report improved performance in function name recovery and vulnerability description tasks.