Empirical Study of Code Large Language Models for Binary Security Patch Detection
作者: Qingyuan Li, Binchang Li, Cuiyun Gao, Shuzheng Gao, Zongjie Li
分类: cs.SE, cs.AI, cs.CR
发布日期: 2025-09-07
💡 一句话要点
利用代码大语言模型进行二进制安全补丁检测的实证研究
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 二进制安全 补丁检测 代码大语言模型 微调 漏洞分析
📋 核心要点
- 现有基于学习的安全补丁检测方法主要针对源代码,无法直接应用于大量闭源软件的二进制补丁检测。
- 该论文探索了利用代码大语言模型(LLM)进行二进制安全补丁检测,通过微调注入二进制安全补丁的领域知识。
- 实验结果表明,微调后的LLM在二进制安全补丁检测任务中表现出色,尤其是在伪代码表示上。
📝 摘要(中文)
安全补丁检测(SPD)对于维护软件安全至关重要,因为未修补的漏洞可能导致严重的安全风险。近年来,许多基于学习的SPD方法在源代码上表现出良好的结果。然而,这些方法通常不能应用于闭源应用程序和专有系统,因为它们仅发布包含二进制文件的补丁,而无法访问源代码,而这些闭源应用和系统构成了现实世界软件的很大一部分。鉴于代码大语言模型(LLM)在代码智能和二进制分析任务(如反编译和编译优化)中表现出的令人印象深刻的性能,它们在检测二进制安全补丁方面的潜力仍未被探索,这暴露了它们已证明的低级代码理解能力与这项关键安全任务之间的重大研究差距。为了解决这一差距,我们构建了一个包含 extbf{19,448}个样本的大规模二进制补丁数据集,具有两种表示形式:汇编代码和伪代码,并系统地评估了 extbf{19}个不同规模的代码LLM,以研究它们在二进制SPD任务中的能力。我们的初步探索表明,直接提示原始代码LLM难以准确识别二进制补丁中的安全补丁,即使是最先进的提示技术也无法弥补原始模型中二进制SPD领域知识的不足。根据初步发现,我们进一步研究了通过两种表示形式将二进制SPD领域知识注入到代码LLM中的微调策略。实验结果表明,微调后的LLM取得了出色的性能,其中在伪代码表示上获得了最佳结果。
🔬 方法详解
问题定义:论文旨在解决闭源软件二进制补丁的安全补丁检测问题。现有基于源代码的安全补丁检测方法无法直接应用于二进制文件,而人工分析二进制补丁耗时且容易出错。因此,需要一种自动化的方法来检测二进制补丁中的安全漏洞。
核心思路:论文的核心思路是利用代码大语言模型(LLM)强大的代码理解能力,通过微调的方式将二进制安全补丁的领域知识注入到LLM中,使其能够识别二进制代码中的安全补丁。选择LLM是因为其在代码智能和二进制分析任务中已展现出潜力。
技术框架:整体框架包括以下几个阶段:1) 构建大规模二进制补丁数据集,包含汇编代码和伪代码两种表示形式。2) 选择多个不同规模的代码LLM进行评估。3) 使用构建的数据集对LLM进行微调,注入二进制安全补丁的领域知识。4) 评估微调后的LLM在二进制安全补丁检测任务中的性能。
关键创新:该论文的关键创新在于探索了利用代码LLM进行二进制安全补丁检测的可能性,并提出了通过微调注入领域知识的策略。此外,论文还构建了一个大规模的二进制补丁数据集,为后续研究提供了基础。
关键设计:论文的关键设计包括:1) 构建包含19,448个样本的大规模二进制补丁数据集,涵盖汇编代码和伪代码两种表示。2) 评估了19个不同规模的代码LLM。3) 采用了微调策略,通过在数据集上训练LLM,使其学习二进制安全补丁的特征。4) 实验中对比了不同表示形式(汇编代码和伪代码)对模型性能的影响。
🖼️ 关键图片
📊 实验亮点
实验结果表明,经过微调的代码LLM在二进制安全补丁检测任务中取得了显著的性能提升。在伪代码表示上,微调后的LLM获得了最佳结果,表明伪代码更适合LLM学习二进制代码的语义信息。该研究为利用代码LLM进行二进制安全分析提供了有力的证据。
🎯 应用场景
该研究成果可应用于自动化软件安全分析、漏洞挖掘和补丁管理。通过自动检测二进制补丁中的安全漏洞,可以帮助安全研究人员和软件开发人员更快地发现和修复漏洞,从而提高软件的安全性。此外,该技术还可以应用于恶意软件分析,帮助识别恶意代码中的漏洞利用程序。
📄 摘要(原文)
Security patch detection (SPD) is crucial for maintaining software security, as unpatched vulnerabilities can lead to severe security risks. In recent years, numerous learning-based SPD approaches have demonstrated promising results on source code. However, these approaches typically cannot be applied to closed-source applications and proprietary systems that constitute a significant portion of real-world software, as they release patches only with binary files, and the source code is inaccessible. Given the impressive performance of code large language models (LLMs) in code intelligence and binary analysis tasks such as decompilation and compilation optimization, their potential for detecting binary security patches remains unexplored, exposing a significant research gap between their demonstrated low-level code understanding capabilities and this critical security task. To address this gap, we construct a large-scale binary patch dataset containing \textbf{19,448} samples, with two levels of representation: assembly code and pseudo-code, and systematically evaluate \textbf{19} code LLMs of varying scales to investigate their capability in binary SPD tasks. Our initial exploration demonstrates that directly prompting vanilla code LLMs struggles to accurately identify security patches from binary patches, and even state-of-the-art prompting techniques fail to mitigate the lack of domain knowledge in binary SPD within vanilla models. Drawing on the initial findings, we further investigate the fine-tuning strategy for injecting binary SPD domain knowledge into code LLMs through two levels of representation. Experimental results demonstrate that fine-tuned LLMs achieve outstanding performance, with the best results obtained on the pseudo-code representation.