Skip to main content
QUICK REVIEW

[Paper Review] BinPro: A Tool for Binary Source Code Provenance

Dhaval Miyani, Zhen Huang|arXiv (Cornell University)|Nov 2, 2017
Software Engineering ResearchComputer Science23 references16 citations
TL;DR

BinPro is a novel tool that uses machine learning and static analysis to compute source-to-binary similarity, enabling accurate determination of whether a binary was derived from a specific source code. It achieves 81% average similarity for matching binaries and source code, even across different compilers and optimization levels, with a 79% average function matching rate.

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.

Motivation & Objective

  • To address the challenge of determining source code provenance of a binary, especially in cases involving compiler optimizations.
  • To enable reliable detection of whether a binary was compiled from a given source code, even without knowing the compiler or optimization level used.
  • To develop a method that is robust across different compilers and optimization settings, ensuring practical applicability in real-world scenarios.
  • To create a system that can predict compiler optimizations like function inlining without analyzing compiler internals.
  • To provide a scalable and accurate tool for license compliance, vulnerability analysis, and software maintenance by linking binaries to their source code origins.

Proposed method

  • BinPro uses a machine learning model trained on binaries compiled from unrelated applications to predict when compiler optimizations—particularly function inlining—will occur.
  • It applies static analysis to extract code features such as function call graphs (FCG), control flow structures, and data flow patterns from both source and binary code.
  • A bipartite matching algorithm is used to align functions between source and binary code based on computed similarity scores derived from the extracted features.
  • The matching process is iterative, incorporating callers and callees into the function matching process to improve accuracy over multiple rounds.
  • The system computes a similarity score between binary and source code, with high scores indicating strong likelihood of derivation.
  • The inlining predictor is trained on GCC-compiled binaries and evaluated on different compilers (e.g., ICC), demonstrating cross-compiler generalization.

Experimental results

Research questions

  • RQ1Can a machine learning model trained on one compiler accurately predict function inlining behavior on a different compiler?
  • RQ2Can source-to-binary similarity be computed effectively even when the compiler or optimization level is unknown?
  • RQ3How does BinPro’s similarity score distinguish between matching and non-matching binary-source pairs across diverse compilation settings?
  • RQ4To what extent does iterative function matching with call graph context improve matching accuracy?
  • RQ5How scalable is BinPro in terms of execution time and memory usage for large software systems?

Key findings

  • BinPro achieves an average similarity score of 81% for matching binary and source code pairs, with a minimum of 59% and a maximum of 96%.
  • For non-matching pairs, the average similarity score is 25%, with a maximum of 43%, indicating a clear separation between matching and non-matching cases.
  • The highest similarity score for any non-matching pair (43%) is still below the lowest similarity score for any matching pair (59%), ensuring no false positives in the tested corpus.
  • BinPro matches functions correctly 79% of the time on average, regardless of the compiler or optimization level used.
  • The inlining predictor achieves 73% accuracy in predicting inlined functions and 17% false positive rate on non-inlined functions when evaluated across compilers.
  • Execution time scales roughly with the number of functions rather than code size, with BinPro taking up to 294 minutes for large systems like BIND (4,764 functions), primarily due to FCG loading overhead.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.