Practical Source Code Recovery from Binary Functions Using Anchor-Based Retrieval and LLM Reasoning

Charles Edward Gagnon, Steven H. H. Ding, Philippe Charland, Benjamin C. M. Fung
7/10/2026
cs.SEcs.AI

No confident code implementation found for this paper.

Abstract

We present a practical pipeline for recovering source code from stripped binary functions by combining reverse engineering, anchor-based source code retrieval, and large language model reasoning. Our binary-to-source-code retrieval method attempts to identify the source function from a source code database, rather than generating approximate decompiled pseudocode.

Show full abstract

It extracts anchors such as strings, constants, external calls, and available function names using Ghidra, retrieves candidate files via an inverted-index search database, narrows candidates to likely function snippets, and re-ranks them with a large language model (LLM) based on disassembly, decompiled code, and source metadata. Confident matches can also serve as anchors in later passes. In an evaluation backed by our high-fidelity source code database on a stripped, optimized tcpdump binary, our proposed binary-to-source matching method achieves 95.2% assembly instruction coverage. Experiments on a GitHub-based retrieval database showed lower performance with 35.5% instruction coverage on average, mainly due to retrieval misses. These results show that source-level binary recovery excels with high-quality databases and remains a useful tool in noisy environments.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{gagnon2026practical,
  title  = {Practical Source Code Recovery from Binary Functions Using Anchor-Based Retrieval and LLM Reasoning},
  author = {Charles Edward Gagnon and Steven H. H. Ding and Philippe Charland and Benjamin C. M. Fung},
  year   = {2026},
  eprint = {2607.09452},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2607.09452v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2607.09452.svg)](https://codeofpaper.com/paper/2607.09452)

Discussion