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

Exploring the Efficacy of Large Language Models (GPT-4) in Binary Reverse Engineering

Saman Pordanesh, Benjamin Tan

Abstract

Reverse engineering (RE) is a critical yet labor-intensive process in cybersecurity, often hindered by the "spaghetti code" produced by decompilers. This study evaluates the potential of GPT-4 to automate and enhance RE tasks. Through a two-phase experimental framework involving simple C exercises and real-world malware, we assess the model's capabilities in code interpretation, function renaming, and security analysis. Our findings reveal that while GPT-4 is highly effective at providing high-level functional overviews and meaningful renaming, it faces significant challenges in granular logic tracing and identifying stealthy malicious behaviors. Additionally, we demonstrate that standard translation metrics like BLEU are unsuitable for evaluating technical code summaries.

Introduction

Binary reverse engineering involves analyzing compiled code to understand its underlying logic, a task essential for vulnerability research and malware analysis. The primary challenge lies in the output of decompilers, which often lacks the original variable names, comments, and structure, making it difficult for human analysts to parse. Large Language Models (LLMs) like GPT-4 offer a promising solution by leveraging their vast training data to "re-humanize" this code. This paper explores whether GPT-4 can bridge the gap between raw decompiled output and actionable security intelligence.

Methodology

The research was conducted in two distinct phases to capture a broad range of RE challenges.

Phase 1: Basic Code Interpretation

The first phase utilized a dataset of 70 simple C programming problems. GPT-4 was tasked with explaining three variations of each code sample: the original source with comments, a stripped version without comments, and a decompiled version generated via Ghidra. Initial evaluation relied on the BLEU (Bilingual Evaluation Understudy) score to compare AI-generated explanations against human-written ground truths.

Phase 2: Malware Analysis

The second phase shifted focus to 15 real-world malware samples sourced from public repositories. These samples were compiled and then decompiled using Ghidra and RetDec to simulate a realistic workflow. Evaluation in this phase moved toward a manual, rubric-based assessment of three scenarios:

  1. Renaming: Suggesting meaningful names for obfuscated functions and variables.
  2. Binary Questioning: Answering specific behavioral questions regarding API usage and logic.
  3. Comprehensive Analysis: Generating functionality overviews and security risk assessments.
Figure 1: The experimental workflow for Phase 2, illustrating the pipeline from source code through decompilation to manual assessment.

Results and Analysis

The "Forest vs. Trees" Phenomenon

A key insight from the study is GPT-4's superior performance in "big picture" analysis compared to granular detail. The model achieved a score of 3.04/5 for identifying primary functionality but dropped to 2.21/5 when asked to explain the role of specific variables. This suggests that while the model understands general logic flow, it struggles with the deep data-flow tracing required for precise variable analysis.

Renaming and Readability

GPT-4 proved highly capable of improving code readability. It achieved "Meaningfulness" scores of 2.83/3 for functions and 2.49/3 for variables. The higher performance in function renaming is attributed to the richer contextual clues provided by function logic compared to the more isolated nature of individual variables.

The Inadequacy of BLEU Scores

One of the most significant methodological findings was the failure of the BLEU score as an evaluation metric for code explanations. Despite providing technically accurate summaries, GPT-4 consistently received low BLEU scores, typically below 0.2.

Figure 2: BLEU score results for Scenario 2, showing consistently low values despite high technical accuracy in the model's output.

This discrepancy arises because BLEU measures n-gram overlap, whereas technical explanations can be semantically identical while using entirely different phrasing. This highlights the need for domain-specific evaluation metrics.

Security and Stealth Blind Spots

In malware analysis, GPT-4 demonstrated a 0% error rate in identifying the main purpose of the code. However, it struggled significantly with detecting stealth techniques, exhibiting a 46.7% error rate in this category. While the model can identify overt malicious behavior, it often misses the subtle obfuscation and anti-analysis tricks employed by sophisticated malware authors.

Discussion and Conclusion

GPT-4 represents a powerful assistant for reverse engineers, particularly in summarizing functionality and restoring readability to decompiled code. However, it is not yet a replacement for human expertise, especially in high-stakes security analysis where subtle logic and stealth are paramount.

Future work should focus on developing specialized datasets tailored for reverse engineering and creating evaluation metrics that prioritize semantic technical accuracy over linguistic overlap. As LLMs evolve, integrating them more deeply into the decompilation pipeline could significantly reduce the manual effort required to secure modern software systems.

Summary updated

BibTeX
@misc{pordanesh2024exploring,
  author = {Saman Pordanesh and Benjamin Tan},
  title = {{Exploring the Efficacy of Large Language Models (GPT-4) in Binary Reverse Engineering}},
  year = {2024},
  eprint = {2406.06637},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.06637},
}
Figure