Unleashing the Power of Generative Model in Recovering Variable Names from Stripped Binary

Xiangzhe Xu, Zhuo Zhang, Zian Su, Ziyang Huang, Shiwei Feng, Yapeng Ye, Nan Jiang, Danning Xie, Siyuan Cheng, Lin Tan, Xiangyu Zhang

Abstract

Recovering human-readable variable names from stripped binaries is a critical challenge in software security and reverse engineering. Traditional classification-based approaches suffer from closed vocabularies and frequency biases, often failing to predict rare or context-specific names. This paper introduces GENNM, a generative framework that leverages fine-tuned Large Language Models (LLMs) and a novel Symbol Preference Optimization (SymPO) technique to reconstruct descriptive variable names. By incorporating global program context and iterative inference, GENNM significantly outperforms existing state-of-the-art methods, particularly in generalizing to unseen variable names.

Introduction

When software is compiled into a binary executable, human-centric metadata such as variable names are typically "stripped" to minimize file size or obscure intellectual property. For reverse engineers, this transformation replaces descriptive identifiers like packet_size with generic placeholders such as v1 or dwParam2, severely hindering code comprehension.

Existing machine learning solutions primarily treat variable name recovery as a classification task. These models select names from a fixed, pre-defined vocabulary. However, this approach faces three fundamental limitations: it cannot generate novel or composite names, it tends to over-predict generic but frequent names (e.g., buffer), and it often ignores the broader calling context of a function.

Figure 1: Comparison between original source code, stripped decompiled code, and the GENNM recovery process.

Methodology

GENNM shifts the paradigm from classification to generation, utilizing a multi-faceted approach to improve recovery accuracy.

Generative Backbone

Built upon pre-trained models like CodeGemma and CodeLlama, GENNM generates variable names token-by-token. This allows the model to compose rare or unique identifiers (e.g., ip_hdrlen) by combining common tokens, even if the specific full name was absent from the training set.

Symbol Preference Optimization (SymPO)

To address the "long-tail" distribution of variable names where models default to high-frequency generic terms, the authors developed SymPO. Adapted from Direct Preference Optimization (DPO), SymPO explicitly trains the model to prefer descriptive, contextually relevant names over generic ones when program logic suggests a specific domain, such as networking or file I/O.

Context-Aware Fine-Tuning and Iterative Inference

GENNM propagates information across the program's call graph. During inference, the model is provided with summaries of a function's callers and callees, offering a global view of data flow. The tool then employs an iterative process, using program analysis and majority voting to refine predictions across the entire binary.

Key Results

GENNM demonstrates a significant leap in performance over previous benchmarks. On the DIRTY and VarCorpus datasets, GENNM improved name recovery precision by 5.6 to 11.4 percentage points compared to VarBERT.

Figure 2: Qualitative comparison showing how SymPO and Context-awareness improve name selection over baseline models.

As illustrated in the figure above, while baseline models like VarBERT may suggest generic names like ip_0 or buffer, GENNM's context-aware generation correctly identifies domain-specific terms like ip_hdr and packet. Notably, in scenarios involving variable names never seen during training, GENNM achieved a 32% improvement in precision (from 17.3% to 22.8%). Furthermore, specialized fine-tuning allowed GENNM to outperform general-purpose "black-box" models like GPT-4.

Conclusion and Future Work

GENNM proves that generative LLMs, when combined with domain-specific optimization and global context, can effectively bridge the gap between machine semantics and human descriptive intent. While the model's performance currently degrades under high compiler optimization levels (e.g., -O3), future work aims to integrate deeper program analysis to handle complex data structures and optimized logic more robustly.

Summary updated

BibTeX
@inproceedings{xu2025unleashing,
  author = {Xiangzhe Xu and Zhuo Zhang and Zian Su and Ziyang Huang and Shiwei Feng and Yapeng Ye and Nan Jiang and Danning Xie and Siyuan Cheng and Lin Tan and Xiangyu Zhang},
  title = {{Unleashing the Power of Generative Model in Recovering Variable Names from Stripped Binary}},
  booktitle = {NDSS},
  year = {2025},
}
Figure