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

Identifying obfuscated code through graph-based semantic analysis of binary code

Roxane Cohen, Robin David, Florian Yger, Fabrice Rossi

Abstract

This paper presents a novel approach for detecting and classifying code obfuscation in binary functions using Graph Neural Networks (GNNs). By representing binary code as Control Flow Graphs (CFGs) and enriching nodes with semantic features derived from Ghidra’s Pcode intermediate representation, the proposed models can distinguish between standard compiler optimizations and complex obfuscation techniques like Control Flow Flattening (CFF). We evaluate several GNN architectures across a diverse dataset of five open-source projects and eleven obfuscation classes. Our results demonstrate that the Graph Isomorphism Network (GIN) architecture, when combined with Pcode-based semantic features, achieves a balanced accuracy of 0.766 on challenging cross-binary classification tasks and successfully identifies obfuscation in real-world malware samples.

Introduction

In the field of cybersecurity, code obfuscation serves as a primary defense mechanism for protecting intellectual property and a common tactic for concealing malicious payloads. Modern obfuscators, such as Tigress and OLLVM, transform program logic so drastically that traditional signature-based detection methods and basic complexity metrics often fail. The challenge lies in identifying not only the presence of obfuscation but also the specific techniques employed—a critical prerequisite for effective deobfuscation.

Comparison of standard compiler optimizations (-O0, -O2) versus Control Flow Flattening (CFF) obfuscation.

As illustrated above, obfuscation techniques like Control Flow Flattening (CFF) fundamentally alter the structure of a function's Control Flow Graph (CFG), making it significantly more complex than even highly optimized legitimate code. This research explores whether deep learning on graphs can bridge the gap in detecting these sophisticated transformations.

Methodology

Graph Representation and Semantic Enrichment

The researchers represent binary functions as CFGs, where nodes correspond to basic blocks (sequences of instructions with a single entry and exit point) and edges represent execution paths. To move beyond simple structural analysis, the models incorporate "node-level" features.

The core innovation is the use of Pcode, an architecture-agnostic Intermediate Representation (IR) used by the Ghidra reverse engineering suite. By extracting Pcode mnemonics within each basic block, the GNNs gain a semantic understanding of the code's behavior that is independent of the underlying hardware (e.g., x86 vs. ARM).

Model Architectures

The study compares traditional machine learning baselines (Random Forest and Gradient Boosting using graph-level features and assembly text statistics) against five GNN architectures:

  • Graph Convolutional Networks (GCN)
  • GraphSAGE
  • Graph Isomorphism Network (GIN)
  • Graph Attention Networks (GAT)
  • Graph UNet

Experimental Setup

Datasets

The authors developed a comprehensive dataset based on five open-source projects (zlib, sqlite, freetype, etc.), applying 11 distinct obfuscation classes. Two evaluation strategies were used:

  1. Dataset-1 (Per Function): Functions and their obfuscated counterparts are mixed within training and test sets.
  2. Dataset-2 (Per Binary): A more realistic "hard" split where the model is trained on specific projects and tested on entirely unseen software, simulating real-world reverse engineering scenarios.

Key Results

Classification Performance

On the challenging "Per Binary" split, the GNN models significantly outperformed non-graph baselines. The GIN architecture emerged as the most effective, achieving a balanced accuracy of 0.766 for binary classification (obfuscated vs. non-obfuscated). For multi-class classification (identifying the specific obfuscation type), the models maintained a lead with approximately 0.675 accuracy on the hard split.

Real-world Validation

To test the practical utility of the approach, the researchers analyzed XTunnel, a malware sample associated with the APT28 group. The model successfully identified obfuscated functions within the malware with a balanced accuracy exceeding 0.71, demonstrating its robustness against "in-the-wild" samples.

Discussion and Future Work

Insights

  • Semantics Matter: GNNs relying solely on graph structure performed poorly. Semantic node features (Pcode) are essential for distinguishing obfuscation from complex legitimate logic.
  • Architectural Strengths: The success of GIN confirms its theoretical capability to distinguish diverse graph structures more effectively than other GNN variants.
  • Semantic Overlap: The model occasionally confused Mixed Boolean Arithmetic (MBA) with Opaque Predicates, which is logically consistent as the latter often utilizes the former to create complex branching conditions.

Limitations

High compiler optimization levels (e.g., -O2) can sometimes mask obfuscation patterns, presenting a hurdle for detection. Additionally, the computational cost of training advanced architectures like GAT remains high. Future research will focus on more complex graph representations, such as Semantic Oriented Graphs (SOG), to capture data flow and side effects alongside control flow.

Summary updated

BibTeX
@article{cohen2025identifying,
  author = {Roxane Cohen and Robin David and Florian Yger and Fabrice Rossi},
  title = {{Identifying obfuscated code through graph-based semantic analysis of binary code}},
  journal = {Appl. Netw. Sci.},
  year = {2025},
  doi = {10.1007/s41109-025-00733-8},
}
Figure