Skip to content
Open access

ReFun: Reconstructing Function Boundaries in EVM Bytecode

Oct 2026 · Proceedings of the ACM on Programming Languages · Vol 10, pp. 1906 - 1933 · 0 citations · 57 references

TL;DR

This work constructs an over-approximated set of potential function call sites based on EVM execution semantics, and narrows them down using rule-based reasoning, then analyzes the instructions before each jump to determine its target and reassemble scattered code fragments into a continuous instruction sequence.

Abstract

Recovering the structure of a Solidity smart contract from its deployed bytecode is a prerequisite for various downstream analyses, such as control-flow graph construction, decompilation, and clone detection. A central step in this task is identifying private functions. However, since all source-level function boundaries are completely lost after compilation, the major challenge of this task lies in how to differentiate function calls from intra-procedural control transfers, because both are implemented via the JUMP/JUMPI instructions. We observe that although jump-based control transfers are superficially uniform, their context information is different. Some contexts provide definitive evidence of an intra-procedural control transfer or a function call, which inspires us to address this problem through progressive refinement rather than naive binary classification. Specifically, we first construct an over-approximated set of potential function call sites based on EVM execution semantics, and then narrow them down using rule-based reasoning. The remaining uncertain cases are finally resolved through probabilistic inference over suggestive contexts. For each identified function, we further analyze the instructions before each jump to determine its target and reassemble scattered code fragments into a continuous instruction sequence. We implement our approach as an open-source tool, dubbed ReFun, and evaluate it on 8,696 real-world Solidity smart contracts across multiple Solidity compiler versions and optimization settings. The experimental results demonstrate that ReFun achieves 94.3% precision and 95.5% recall in function recovery, and it is also efficient, completing function identification and separation for 82% of contracts within eight seconds per contract. Finally, we show how ReFun is applied to the downstream tasks, including contract decompilation and clone detection.

Read PDF

Similar papers

Book Open access Oct 2026

Pattern-Guided Static Analysis for APIfication of COBOL Monoliths

Legacy COBOL mainframes resist APIfication due to monolithic structure and scattered logic. We present a novel pipeline that takes code blocks selected and validated by the user, potentially with AI-assisted boundary suggestions, and generates compilable API modules with request/response copybooks. Key innovations incl...

Vini Kanvar, Ashwina Kumar, Keerthi Narayan Raghunath · 1 citation
Open access Oct 2026

ConUT: Condition-Aware Test Generation for Complex Java Code

Automatically generating high-coverage unit tests for complex Java methods remains a formidable challenge, particularly when execution paths are guarded by intricate control-flow nesting and cross-class state dependencies. Existing LLM-based approaches predominantly follow a goal-driven paradigm, relying on unguided co...

Rui-Guo Yu, Rui-Qi Dong, Xi Xiao et al. · 0 citations
Preprint Nov 2026

LOHRE: Execution-Grounded Type Recovery via LLM-Orchestrated Hybrid Analysis

Documenting stripped binary functions for security analysis requires recovering function interfaces and user-defined type (UDT) layouts from machine code. Existing large language model (LLM)-based methods face two limitations: they lack execution-based validation to detect inferred UDTs inconsistent with actual memory...

Hao Jiang, Yu-Jie Yang, Tao Li et al. · 0 citations
Book Open access Oct 2026

Decompiling the Web: Automated Semantic Recovery of Post-compilation Abstraction Leaks

This study shows that automated semantic recovery is needed to audit build artifacts and map the obscured attack surfaces of modern web deployments, using JS Recon, an automated semantic recovery framework that performs decompiler-like analysis for modern JavaScript bundles.

Shriyans Sudhi, Yin-Xi Liu · 1 citation
#artificial intelligence Preprint Oct 2026

SpecCloak: Probing Harmful Code Generation through Engineering Specifications

The code generation capabilities of large language models (LLMs) can equally be misused to implement harmful functionality, underscoring the need to understand their safety behavior in response to programming requests. While request phrasing is known to influence refusal, it remains unclear whether the form in which co...

Wen-Bin Chen, Jie-Xin Wang, Guan-Ting Wu et al. · 0 citations
Preprint Oct 2026

ExeBench-FHD: Addressing Fidelity Issues in Decompiler Evaluation

ExeBench is one of the most widely used benchmarks for evaluating LLM-based decompilers. We analyze ExeBench and identify nine issues that affect how faithfully a test measures a decompiler. Three of them prevent LLM decompilers from recovering C code from ExeBench's function. These are ambiguous parameter order when i...

Akarsh Ashok, Dinil Mon Divakaran, Vivek Balachandran · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.