Back to search

National and Kapodistrian University of Athens

From stack to structure: decompiling Ethereum smart contracts via static program analysis

Abstract

dc:description

Ethereum-based blockchains have been the de facto option for programmable blockchains for over a decade. Ethereum's general and low-level runtime, the Ethereum Virtual Machine (EVM), enabled the rapid development of an ecosystem of decentralized applications built using smart contracts deployed on the blockchain. Security is a major consideration in such a domain as smart contracts can be interacted with by any other on-chain entity, and exploits resulting in significant financial losses are not uncommon. However, the EVM's low-level nature also introduces a new challenge: it was not made to facilitate human understanding and automated analyses. As a contract's EVM bytecode is its only available on-chain artifact, it is crucial to create automated tooling to better understand it. In this thesis we design and employ over-approximate static analysis techniques to create a decompilation pipeline that enables reverse engineering and downstream program analyses. Our decompilation pipeline progressively abstracts away compilation artifacts introduced by compiling high-level source code to EVM bytecode, recovering the higher-level constructs. The contributions of this thesis are split into two parts. The first part focuses on recovering a structured intermediate representation with functions, register variables, and resolved control-flow edges from the low-level stack-based bytecode lacking all the above. In the second part of this thesis, we use that representation in order to enrich it with additional information about the objects stored in the EVM's various heap-like stores. A recurring theme in the contributions in the first part of this thesis is the use of domain-tailored context-sensitivity variants to compute the program's control-flow graph (CFG) in a precise, complete, and scalable manner. This context-sensitive CFG is then used to recognize public and private functions in the unstructured input. Along with other presented techniques such as the cloning of low-level blocks, our lifter was successfully evaluated against state-of-the-art academic and industrial tools.In the second part of this thesis we focus on modeling the EVM's stores. We first focus on ``memory'', a transient store used for inter-contract communication, computing cryptographic hashes, and more. All of these high-level constructs are compiled down to memory store and load instructions, operating on low-level pointers. We design an analysis recovering high-level information and manage to model over 92% of low-level store and load instructions. Our last contribution focused on recovering structure in the EVM's persistent storage. We design and implement an analysis that recovers the arbitrarily nested data structures residing in storage, managing to surpass the state-of-the-art in all axes (scalability, precision, and completeness) while often inferring more structures than the compiler-produced metadata. We also show how the modeling of memory and storage is instrumental for many downstream analyses.

Degree

thesis:*
Grantor dc:publisher
National and Kapodistrian University of Athens
Year dc:date
2026

Author and committee

dc:creator, dc:contributor.*
Authors dc:creator
  • Lagouvardos, Iosif
  • Λαγουβάρδος, Ιωσήφ

Subjects

dc:subject × 12

Rights

Language dc:language
eng

Identifiers

dc:identifier.*
Identifier
10.12681/eadd/62071

Chain of custody

source
Harvested from
Greek National Archive of PhD Theses
Base URL
phdtheses.ekt.gr/eadd_oai/request
Last updated
2026-11-18
Source record
OAI-PMH GetRecord
citation

Lagouvardos, Iosif; Λαγουβάρδος, Ιωσήφ. From stack to structure: decompiling Ethereum smart contracts via static program analysis. National and Kapodistrian University of Athens, 2026. http://hdl.handle.net/10442/hedi/62071