Skip to main content
QUICK REVIEW

[Paper Review] Unsupervised Features Extraction for Binary Similarity Using Graph Embedding Neural Networks

Roberto Baldoni, Giuseppe Antonio Di Luna|arXiv (Cornell University)|Oct 23, 2018
Software Engineering ResearchComputer Science21 references9 citations
TL;DR

This paper proposes an unsupervised feature learning approach for binary function similarity by using graph embedding neural networks to generate embeddings from annotated control flow graphs (ACFGs). Instead of manual feature engineering, it leverages word2vec-style instruction embeddings (i2v) to automatically derive vertex features, achieving a 2% performance gain over state-of-the-art methods in binary similarity tasks while enabling meaningful semantic clustering in the embedding space.

ABSTRACT

In this paper we consider the binary similarity problem that consists in determining if two binary functions are similar only considering their compiled form. This problem is know to be crucial in several application scenarios, such as copyright disputes, malware analysis, vulnerability detection, etc. The current state-of-the-art solutions in this field work by creating an embedding model that maps binary functions into vectors in $\mathbb{R}^{n}$. Such embedding model captures syntactic and semantic similarity between binaries, i.e., similar binary functions are mapped to points that are close in the vector space. This strategy has many advantages, one of them is the possibility to precompute embeddings of several binary functions, and then compare them with simple geometric operations (e.g., dot product). In [32] functions are first transformed in Annotated Control Flow Graphs (ACFGs) constituted by manually engineered features and then graphs are embedded into vectors using a deep neural network architecture. In this paper we propose and test several ways to compute annotated control flow graphs that use unsupervised approaches for feature learning, without incurring a human bias. Our methods are inspired after techniques used in the natural language processing community (e.g., we use word2vec to encode assembly instructions). We show that our approach is indeed successful, and it leads to better performance than previous state-of-the-art solutions. Furthermore, we report on a qualitative analysis of functions embeddings. We found interesting cases in which embeddings are clustered according to the semantic of the original binary function.

Motivation & Objective

  • To address the challenge of binary function similarity in malware analysis, vulnerability detection, and copyright disputes without relying on source code.
  • To reduce human bias in feature engineering by replacing manually designed ACFG features with unsupervised learning techniques.
  • To evaluate whether unsupervised instruction embedding models (e.g., i2v) can improve the quality of graph embeddings for binary functions.
  • To investigate whether learned embeddings capture semantic and syntactic structure of assembly code, enabling meaningful clustering and analogical reasoning.
  • To explore the generalization capability of embeddings beyond same-source-code binaries, suggesting potential for broader software analysis applications.

Proposed method

  • Constructs Annotated Control Flow Graphs (ACFGs) from compiled binary functions, where each basic block is a vertex with features derived from assembly instructions.
  • Applies an unsupervised instruction embedding model (i2v) trained on a large corpus of assembly code to map individual instructions into dense vectors.
  • Computes vertex feature vectors by applying a weighted average of instruction embeddings within each basic block, using an attention mechanism in the best-performing variant (i2v_attention).
  • Uses a Structure2Vec-based graph neural network to embed the entire ACFG into a fixed-size vector in R^n, preserving structural and semantic similarity.
  • Employs t-SNE for dimensionality reduction to visualize and qualitatively analyze the semantic clustering of function embeddings.
  • Evaluates performance using standard binary similarity benchmarks, comparing unsupervised feature learning against manual feature engineering.

Experimental results

Research questions

  • RQ1Can unsupervised instruction embedding models like i2v outperform manually engineered features in generating effective ACFG embeddings for binary similarity?
  • RQ2Do the learned embeddings capture semantic relationships between assembly instructions, such as arithmetic operations or memory access patterns?
  • RQ3Can the embedding space reveal meaningful clustering of functions based on their semantic behavior, even when compiled from the same source code or with different optimizations?
  • RQ4Is there evidence of analogical reasoning in the embedding space, such as vector arithmetic capturing instruction transformations (e.g., add → sub)?
  • RQ5To what extent do the embeddings generalize beyond same-source-code binaries, suggesting potential for broader software analysis tasks?

Key findings

  • The i2v_attention model, which uses attention-weighted instruction embeddings, achieved a 2% improvement in binary similarity performance over state-of-the-art methods based on manual feature engineering.
  • Qualitative t-SNE visualization revealed clear clustering of function embeddings by semantic type (e.g., AES helper functions, Camellia encryption/decryption), indicating semantic preservation in the embedding space.
  • The i2v model successfully captured syntactic and semantic relationships between assembly instructions, as evidenced by vector analogies such as add → sub and ldr → str transformations.
  • Embeddings of the same function across different compilers or architectures were found to cluster closely, suggesting robustness to compilation differences.
  • The sampling-based feature extraction method performed poorly, indicating it is unsuitable for binary similarity tasks.
  • The results suggest that unsupervised instruction embeddings can generalize beyond same-source-code binaries, hinting at potential for broader applications in software analysis.

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.