Skip to main content
QUICK REVIEW

[论文解读] BinMatch: A Semantics-based Hybrid Approach on Binary Code Clone Analysis

Yikun Hu, Yuanyuan Zhang|arXiv (Cornell University)|Aug 19, 2018
Software Engineering Research参考文献 37被引用 4
一句话总结

BinMatch 通过执行模板函数并使用迁移的运行时信息模拟目标函数,提出了一种基于语义的混合方法进行二进制代码克隆检测,以提取语义签名。该方法在鲁棒性、代码转换抗性以及检测精度方面优于现有最先进方法,在超过一亿对函数对的检测中实现了高准确率和全代码覆盖率。

ABSTRACT

Binary code clone analysis is an important technique which has a wide range of applications in software engineering (e.g., plagiarism detection, bug detection). The main challenge of the topic lies in the semantics-equivalent code transformation (e.g., optimization, obfuscation) which would alter representations of binary code tremendously. Another chal- lenge is the trade-off between detection accuracy and coverage. Unfortunately, existing techniques still rely on semantics-less code features which are susceptible to the code transformation. Besides, they adopt merely either a static or a dynamic approach to detect binary code clones, which cannot achieve high accuracy and coverage simultaneously. In this paper, we propose a semantics-based hybrid approach to detect binary clone functions. We execute a template binary function with its test cases, and emulate the execution of every target function for clone comparison with the runtime information migrated from that template function. The semantic signatures are extracted during the execution of the template function and emulation of the target function. Lastly, a similarity score is calculated from their signatures to measure their likeness. We implement the approach in a prototype system designated as BinMatch which analyzes IA-32 binary code on the Linux platform. We evaluate BinMatch with eight real-world projects compiled with different compilation configurations and commonly-used obfuscation methods, totally performing over 100 million pairs of function comparison. The experimental results show that BinMatch is robust to the semantics-equivalent code transformation. Besides, it not only covers all target functions for clone analysis, but also improves the detection accuracy comparing to the state-of-the-art solutions.

研究动机与目标

  • 解决语义等价代码转换(如优化、混淆)导致传统基于语法和结构的克隆检测失效的挑战。
  • 克服纯静态或动态分析方法固有的检测准确率与代码覆盖率之间的权衡。
  • 开发一种混合方法,利用执行模板函数的运行时语义并模拟目标函数,以确保全代码覆盖率。
  • 实现在不同编译配置和现实世界二进制文件中常见混淆技术下的鲁棒克隆检测。

提出的方法

  • 使用真实测试用例对模板二进制函数进行插桩并执行,以捕获其运行时行为,包括输入值、内存访问和系统调用。
  • 将模板函数的运行时信息(如参数值、控制流)迁移到每个候选目标函数,用于执行模拟。
  • 使用迁移的运行时上下文模拟每个目标函数,以在执行过程中提取语义签名。
  • 基于内存读写值、比较操作数和库函数调用提取语义签名,以表示功能行为。
  • 使用相似度分数比较模板函数与目标函数的语义签名以检测克隆。
  • 在模拟过程中实现新颖策略,以处理间接调用、跳转和全局变量读取,从而保持语义保真度。

实验结果

研究问题

  • RQ1结合动态执行与静态模拟的混合方法是否能在二进制克隆检测中同时实现高检测准确率和全代码覆盖率?
  • RQ2所提出方法对语义等价代码转换(如编译器优化和代码混淆)的鲁棒性如何?
  • RQ3从运行时行为和模拟中提取的语义签名是否能优于基于语法和结构的特征在克隆检测中的表现?
  • RQ4当分析使用不同配置编译或采用常见技术混淆的二进制文件时,该方法在准确率方面能保持多大程度的稳定性?

主要发现

  • BinMatch 对多种语义等价代码转换(包括链接时优化和常见混淆技术)表现出强鲁棒性。
  • 通过使用模板函数迁移的运行时信息模拟每个目标函数,系统实现了对所有目标函数的100%覆盖率。
  • 与 BinDiff 和 Kam1n0 等最先进的工具相比,BinMatch 在检测准确率和抗代码转换能力方面均表现更优。
  • 该方法通过从内存操作、比较和库调用中提取的语义签名,成功捕捉了核心功能语义。
  • 在八个真实世界项目中分析了超过一亿对函数对,这些项目使用多样化编译配置构建,验证了方法的可扩展性和有效性。
  • 执行-模拟混合策略无需依赖语法特征,即可实现丰富的语义捕获,从而提高了检测的可靠性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。