Skip to main content
QUICK REVIEW

[论文解读] BinPro: A Tool for Binary Source Code Provenance

Dhaval Miyani, Zhen Huang|arXiv (Cornell University)|Nov 2, 2017
Software Engineering Research参考文献 23被引用 16
一句话总结

BinPro 是一种新颖的工具,结合机器学习与静态分析技术,用于计算源代码与二进制文件之间的相似性,从而实现对二进制文件是否源自特定源代码的准确判定。即使在不同编译器和优化级别下,其对匹配的二进制文件与源代码对的平均相似度仍可达 81%,函数匹配准确率达到 79%。

ABSTRACT

Enforcing open source licenses such as the GNU General Public License (GPL), analyzing a binary for possible vulnerabilities, and code maintenance are all situations where it is useful to be able to determine the source code provenance of a binary. While previous work has either focused on computing binary-to-binary similarity or source-to-source similarity, BinPro is the first work we are aware of to tackle the problem of source-to-binary similarity. BinPro can match binaries with their source code even without knowing which compiler was used to produce the binary, or what optimization level was used with the compiler. To do this, BinPro utilizes machine learning to compute optimal code features for determining binary-to-source similarity and a static analysis pipeline to extract and compute similarity based on those features. Our experiments show that on average BinPro computes a similarity of 81% for matching binaries and source code of the same applications, and an average similarity of 25% for binaries and source code of similar but different applications. This shows that BinPro's similarity score is useful for determining if a binary was derived from a particular source code.

研究动机与目标

  • 为解决在涉及编译器优化的情况下,确定二进制文件源代码来源的挑战。
  • 实现对二进制文件是否由给定源代码编译生成的可靠检测,即使在未知编译器或优化级别时亦可。
  • 开发一种在不同编译器和优化设置下均具有鲁棒性的方法,确保在真实场景中的实际可用性。
  • 构建一种无需分析编译器内部机制即可预测编译器优化(如函数内联)的机制。
  • 提供一种可扩展且准确的工具,用于许可证合规性检查、漏洞分析及软件维护,实现二进制文件与其源代码源头的关联。

提出的方法

  • BinPro 使用在来自无关应用程序的二进制文件上训练的机器学习模型,预测在不同编译器下函数内联等优化行为的发生。
  • 通过静态分析提取源代码和二进制代码中的代码特征,如函数调用图(FCG)、控制流结构和数据流模式。
  • 采用二分图匹配算法,基于提取特征计算出的相似度得分,对源代码与二进制代码中的函数进行对齐。
  • 匹配过程为迭代式,将调用者与被调用者纳入函数匹配过程,通过多轮迭代提升匹配准确性。
  • 系统计算二进制代码与源代码之间的相似度得分,高分表示存在强来源关联性。
  • 内联预测器在 GCC 编译的二进制文件上进行训练,并在其他编译器(如 ICC)上进行评估,展示了跨编译器的泛化能力。

实验结果

研究问题

  • RQ1在一种编译器上训练的机器学习模型,能否准确预测在另一种编译器上的函数内联行为?
  • RQ2当编译器或优化级别未知时,是否仍能有效计算源代码与二进制文件之间的相似性?
  • RQ3BinPro 的相似度得分在不同编译设置下,如何有效区分匹配与非匹配的二进制-源代码对?
  • RQ4结合调用图上下文的迭代式函数匹配,在多大程度上提升了匹配准确性?
  • RQ5BinPro 在大规模软件系统中的执行时间与内存使用方面,其可扩展性如何?

主要发现

  • BinPro 对匹配的二进制-源代码对实现了 81% 的平均相似度得分,最低为 59%,最高达 96%。
  • 对于非匹配对,平均相似度得分为 25%,最高为 43%,表明匹配与非匹配情况之间存在明显区分。
  • 任何非匹配对中的最高相似度得分(43%)仍低于任何匹配对中的最低相似度得分(59%),确保在测试语料库中无误报。
  • 无论使用何种编译器或优化级别,BinPro 平均 79% 的时间正确匹配函数。
  • 在跨编译器评估中,内联预测器对内联函数的预测准确率达到 73%,对非内联函数的误报率为 17%。
  • 执行时间大致与函数数量成正比,而非代码大小;对于大型系统(如 BIND,含 4,764 个函数),BinPro 最长耗时 294 分钟,主要因 FCG 加载开销所致。

更好的研究,从现在开始

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

无需绑定信用卡

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