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

FlowMalTrans: Unsupervised Binary Code Translation for Malware Detection Using Flow-Adapter Architecture

Minghao Hu, Junzhe Wang, Weisen Zhao, Qiang Zeng, Lannan Luo

TL;DR

This paper introduces FlowMalTrans, a novel unsupervised approach to translate binary code between different Instruction Set Architectures (ISAs). This translation capability significantly enhances malware detection by allowing models trained on high-resource ISAs (like x86-64) to effectively analyze malware from low-resource ISAs, overcoming data scarcity challenges.

What Problem Does This Paper Address?

Malware is a persistent threat that evolves rapidly and targets a wide array of computing architectures (ISAs). While deep learning has shown great promise in malware detection, its effectiveness is heavily reliant on large, labeled datasets. Creating such datasets for every ISA is a monumental and time-consuming task, especially for less common ISAs (low-resource ISAs) where malware samples are scarce. This data gap limits the ability to detect malware across the diverse landscape of modern computing devices. Existing methods often struggle with the inherent differences in binary code across ISAs, making cross-ISA analysis difficult.

Methods

FlowMalTrans tackles this problem by leveraging Neural Machine Translation (NMT) and Normalizing Flows (NFs). The core idea is to translate binary code from a source ISA to a target ISA (specifically, x86-64, which has abundant malware samples) where a pre-trained malware detection model already exists.

Here's a breakdown of the key techniques:

  • Unsupervised Binary Code Translation: The system learns to translate binary code without requiring paired source-target examples. It uses readily available open-source programs for training, avoiding the need for malware samples during this translation phase.
  • Flow-Adapter Architecture: This architecture uses a pair of Normalizing Flows (NFs) to model the distributions of latent representations for basic blocks in both the source and target ISAs. NFs are powerful generative models that can learn complex, high-dimensional distributions through invertible transformations, enabling precise mapping between ISA representations.
  • Separate Encoders/Decoders: Unlike some prior work that uses shared components, FlowMalTrans employs separate encoders and decoders for each ISA. This allows the model to capture ISA-specific syntax and semantics more effectively.
  • Transformer Network: The encoders and decoders are built using a multi-layer bi-directional Transformer, which is adept at capturing long-range dependencies in sequential data like assembly code.
  • Instruction Normalization: To handle variations in assembly code, several normalization rules are applied, such as replacing dummy names, function names, and numerical constants with special tokens.

Datasets

The paper utilizes several datasets:

  • Training for FlowMalTrans: Various open-source programs (openssl, binutils, findutils, libgpg-error) compiled for each of the seven target ISAs (x86-64, i386, ARM32, ARM64, MIPS32, PPC32, M68K). Crucially, no malware samples are used for training FlowMalTrans itself.
  • Training for Malware Detection Model: Malware samples collected from VirusShare.com for the target ISA (x86-64).
  • Testing for Malware Detection: Malware and benign samples from various sources (zlib, coreutils, diffutils) for each ISA.

Key Insights and Ideas

  • Bridging the ISA Gap: The most significant insight is that by translating binary code to a high-resource ISA, we can effectively reuse powerful malware detection models trained on that ISA for low-resource ISAs, dramatically reducing the need for ISA-specific malware datasets.
  • Normalizing Flows for Precision: The use of Normalizing Flows is key to accurately modeling the complex distributions of binary code representations across different ISAs, leading to high-fidelity translations.
  • ISA-Specific Representations Matter: The decision to use separate encoders for each ISA, rather than a shared one, allows the model to better capture the unique characteristics of each architecture, which is crucial for accurate translation.
  • Unsupervised Translation is Sufficient: The fact that FlowMalTrans can achieve high translation quality and enable effective malware detection without ever seeing malware samples during its translation training is a major advantage.

Key Results

  • Superior Translation Quality: FlowMalTrans achieved higher BLEU scores than the baseline UnsuperBinTrans across all tested ISA pairs, demonstrating its effectiveness in binary code translation.
  • Effective Malware Detection: When applied to malware detection, FlowMalTrans enabled models trained on x86-64 to achieve high AUC scores (e.g., 0.996 for i386, 0.981 for ARM32, 0.965 for ARM64) when analyzing translated binaries from other ISAs. These results were often comparable to, and sometimes surpassed, models trained and tested on the same ISA, especially in cases where the same-ISA model suffered from limited training data.
  • Scalability: Translating a basic block takes approximately 10⁻⁴ seconds, and a full binary translation takes around 1.2 seconds, indicating good scalability.

Limitations and Future Work

  • Operating System Dependency: The current evaluation is limited to Linux-based malware samples. Extending the framework to other operating systems (Windows, iOS, Android) is an open question.
  • Malware Packing and Obfuscation: The research excludes packed or obfuscated malware, which presents significant challenges for analysis. Future work could investigate how obfuscation techniques affect detection capabilities.
  • Target ISA Exploration: While the focus is on translating to x86-64, exploring ARM32 as an alternative target ISA could be beneficial due to its substantial malware dataset.
  • Broader Applications: The translation framework shows promise for other binary analysis tasks like vulnerability discovery and code similarity analysis.
  • Large Language Models (LLMs): The authors suggest exploring the use of LLMs for binary code translation as a future research direction.

Summary updated

BibTeX
@inproceedings{hu2025flowmaltrans,
  author = {Minghao Hu and Junzhe Wang and Weisen Zhao and Qiang Zeng and Lannan Luo},
  title = {{FlowMalTrans: Unsupervised Binary Code Translation for Malware Detection Using Flow-Adapter Architecture}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2025},
}
Figure