NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Asteria: Deep Learning-based AST-Encoding for Cross-platform Binary Code Similarity Detection

Shouguo Yang, Long Cheng, Yicheng Zeng, Zhe Lang, Hongsong Zhu, Zhiqiang Shi

Abstract

Binary Code Similarity Detection (BCSD) is a critical task in security research, particularly for identifying vulnerable code across diverse IoT hardware architectures. Traditional methods relying on Control Flow Graphs (CFGs) often struggle with architectural variations. This paper presents Asteria, a novel deep learning-based approach that encodes Abstract Syntax Trees (ASTs) into high-dimensional vectors using Tree-LSTM networks. By focusing on semantic logic rather than hardware-dependent control flow, Asteria achieves superior accuracy and significant speedups in cross-platform similarity detection.

Introduction

The proliferation of Internet of Things (IoT) devices has led to widespread code reuse across various hardware architectures, including ARM, MIPS, x86, and PowerPC. When a vulnerability is discovered in a common third-party library, security researchers must locate all instances of the vulnerable function across thousands of firmware images. This task, known as Binary Code Similarity Detection (BCSD), is complicated by the fact that the same source code produces vastly different assembly instructions and control flow structures when compiled for different platforms.

The Challenge of Cross-Platform Similarity

Existing BCSD tools often utilize Control Flow Graphs (CFGs) to represent program structure. However, CFGs are heavily influenced by architecture-specific details such as register allocation and stack layouts. As shown in Figure 4, while the CFGs for the same function on x86 and ARM platforms differ significantly, their Abstract Syntax Trees (ASTs) remain remarkably consistent. This stability makes ASTs a more robust representation for capturing the underlying logic (semantics) of the code.

Comparison of ASTs and CFGs across x86 and ARM platforms.

Methodology: The Asteria Pipeline

Asteria shifts the focus from assembly-level graphs to the hierarchical structure of source code. The pipeline consists of five primary stages:

  1. Decompilation: Raw binary code is transformed back into an AST using a decompiler such as IDA Pro.
  2. Preprocessing: AST nodes are "digitalized" into integer labels based on their semantic types (e.g., assignments, comparisons).
  3. AST Encoding via Tree-LSTM: Unlike standard LSTMs that process linear sequences, Asteria employs a Tree-LSTM. This architecture processes data from the leaves to the root, effectively learning a mathematical "summary" (vector embedding) that respects the nested, hierarchical nature of the code.
  4. Siamese Network Architecture: To compare two functions, Asteria uses a Siamese network consisting of two identical Tree-LSTMs. The similarity is determined by calculating the distance between the resulting vector embeddings.
  5. Callee Calibration: A final calibration step adjusts the similarity score based on the number of external function calls, helping to distinguish between logically similar but functionally distinct code segments.
Mapping of source code to its corresponding Abstract Syntax Tree (AST).

Experimental Evaluation

The researchers evaluated Asteria using three comprehensive datasets:

  • Buildroot Dataset: Over 1 million function pairs generated from 49,725 binaries across four architectures (ARM, x86, x64, PPC).
  • OpenSSL Dataset: Used for benchmarking against existing state-of-the-art tools.
  • Firmware Dataset: A real-world collection of 5,979 IoT firmware images from major vendors.

Key Results

  • Accuracy: Asteria outperformed Gemini (the previous state-of-the-art deep learning tool) by 4.4% in AUC and exceeded the performance of Diaphora by 77%.
  • Efficiency: The Siamese approach allows for nearly instantaneous "online" similarity calculations. Asteria is 10,000 times faster than Gemini and 1,000,000 times faster than Diaphora during the search phase.
  • Real-World Impact: Asteria successfully identified 75 previously unknown vulnerable functions across nearly 6,000 firmware images, linked to seven major CVEs.

Discussion and Future Work

Asteria demonstrates that AST-based encoding is a powerful paradigm for cross-platform binary analysis. By capturing the stable logic of code, it overcomes the limitations of architecture-dependent graph representations. Future work will focus on reducing the computational overhead of the "offline" encoding phase—potentially through the use of Transformer architectures—and incorporating constant values and strings into the embeddings to further enhance detection precision.

Summary updated

BibTeX
@inproceedings{yang2021asteria,
  author = {Shouguo Yang and Long Cheng and Yicheng Zeng and Zhe Lang and Hongsong Zhu and Zhiqiang Shi},
  title = {{Asteria: Deep Learning-based AST-Encoding for Cross-platform Binary Code Similarity Detection}},
  booktitle = {DSN},
  year = {2021},
  doi = {10.1109/dsn48987.2021.00036},
}
Figure