Is Function Similarity Over-Engineered? Building a Benchmark

Rebecca Saul, Chang Liu, Noah Fleischmann, Richard Zak, Kristopher K. Micinski, Edward Raff, James Holt

TL;DR

Researchers have long assumed that detecting similarity between binary functions requires complex features like control-flow graphs or disassembly. This paper introduces REFUSE-BENCH, a massive new benchmark that reveals a surprising truth: a simple convolutional neural network (CNN) trained only on raw bytes can outperform state-of-the-art transformer and graph-based models, especially when scaled to real-world Windows and malware datasets.

What Problem Does This Paper Address?

Binary Function Similarity Detection (BFSD) is the "needle in a haystack" problem of cybersecurity. If you have a piece of malware, you want to know if its functions match known vulnerabilities or previously analyzed code—without having access to the original source code.

The authors argue that the current state of BFSD research is "over-engineered" and disconnected from reality. Most existing models rely on expensive preprocessing (like disassembling code into assembly or building complex graphs), which is slow and prone to errors. Furthermore, existing benchmarks often suffer from "data leakage" (where the model accidentally sees parts of the test set during training) and focus almost exclusively on Linux, ignoring Windows—the primary target for most real-world malware.

Methods: The REFuSe Baseline

The authors propose a surprisingly simple baseline model called REFuSe (Reverse Engineering Function Search).

Architecture of the REFuSe model operating on raw bytes.

Unlike "heavyweight" models that use Graph Neural Networks (GNNs) or Transformers on assembly code, REFuSe is an adaptation of MalConv, a classic architecture for malware detection. As shown above, it takes raw bytes as input, passes them through a byte-embedding layer, two 1-D convolutional layers, and a temporal max-pooling layer to produce a "semantic embedding" (a mathematical representation of the function).

To train it, they use Triplet Learning. The model is shown three functions: an "anchor," a "positive" (a similar function), and a "negative" (a different function). The goal is to teach the model to push similar functions closer together in mathematical space and pull different ones apart.

Datasets: Introducing REFUSE-BENCH

The core contribution is REFUSE-BENCH, a suite of five test sets designed to mirror real-world security tasks.

Overview of the datasets included in REFUSE-BENCH.

The benchmark includes:

  • Assemblage: A massive Windows dataset with over 24 million functions scraped from GitHub.
  • MOTIF: A dataset of real-world Windows malware families.
  • Common Libraries: Multiple versions of popular Windows projects (like OpenSSL and zlib) to test how models handle code evolution.
  • Marcelli & BinaryCorp: Standard Linux-based datasets used to compare against prior academic work.

The authors highlight that their training set (97 million functions) is orders of magnitude larger than the median dataset used in previous research (which often used only ~3.7k binaries).

Key Insights and Ideas

  • The "Pool Size" Illusion: Many academic papers report high accuracy by searching for a match within a small "pool" of 100 functions. The authors show that as the pool size grows to realistic levels (thousands or millions), the performance of complex models like jTrans plummets, while the simple byte-based REFuSe remains stable.
  • Windows is the Blind Spot: Most BFSD research happens on Linux, but the authors found that models trained on Linux often fail to generalize to Windows binaries due to different calling conventions and compiler behaviors.
  • Complexity vs. Utility: The fact that raw bytes perform so well suggests that current "high-level" features (like control-flow graphs) might not be providing the value researchers think they are, or at least aren't being utilized to their full potential.
  • Data Hygiene Matters: The authors identified six major discrepancies in how previous datasets were built, including "leakage" where functions from the same project appeared in both training and testing, artificially inflating scores.

Key Results

The simple REFuSe model achieved state-of-the-art (SOTA) performance on four out of five datasets:

  • On the Assemblage (Windows) dataset, REFuSe achieved a Mean Reciprocal Rank (MRR) of 0.61, crushing the complex GNN (0.26) and jTrans (0.26) models.
  • On Malware (MOTIF), REFuSe maintained a strong 0.68 MRR, while other models struggled to generalize to malicious code.
  • Speed and Efficiency: While tools like BSim take 24 minutes of CPU time per file to extract features, REFuSe operates directly on bytes, making it far more viable for deployment in high-volume antivirus or reverse-engineering pipelines.

Limitations and Future Work

The authors acknowledge that "similarity" is not a binary state but a spectrum. For example, a function written for integers vs. booleans might have identical logic but look different at the byte level. Their current labeling system relies on heuristics (like function names and sizes), which might miss some nuances of semantic equivalence.

Future work involves refining these labels and investigating why complex models are failing to beat the simple byte-based baseline. The authors suggest that instead of adding more "engineering" to the models, the field needs better data and more rigorous evaluation standards—which REFUSE-BENCH aims to provide.

Summary updated

BibTeX
@inproceedings{saul2024is,
  author = {Rebecca Saul and Chang Liu and Noah Fleischmann and Richard Zak and Kristopher K. Micinski and Edward Raff and James Holt},
  title = {{Is Function Similarity Over-Engineered? Building a Benchmark}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
}
Figure