Taming callbacks for smart contract modularity
Elvira Albert, Shelly Grossman, Noam Rinetzky, Clara Rodríguez-Núñez, Albert Rubio, Mooly Sagiv
摘要
Callbacks are an effective programming discipline for implementing event-driven programming, especially in environments like Ethereum which forbid shared global state and concurrency. Callbacks allow a callee to delegate the execution back to the caller. Though effective, they can lead to subtle mistakes principally in open environments where callbacks can be added in a new code. Indeed, several high profile bugs in smart contracts exploit callbacks. We present the first static technique ensuring modularity in the presence of callbacks and apply it to verify prominent smart contracts. Modularity ensures that external calls to other contracts cannot affect the behavior of the contract. Importantly, modularity is guaranteed without restricting programming.
In general, checking modularity is undecidableÐeven for programs without loops. This paper describes an effective technique for soundly ensuring modularity harnessing SMT solvers. The main idea is to define a constructive version of modularity using commutativity and projection operations on program segments. We believe that this approach is also accessible to programmers, since counterexamples to modularity can be generated automatically by the SMT solvers, allowing programmers to understand and fix the error.
We implemented our approach in order to demonstrate the precision of the modularity analysis and applied it to real smart contracts, including a subset of the 150 most active contracts in Ethereum. Our implementation decompiles bytecode programs into an intermediate representation and then implements the modularity checking using SMT queries. Overall, we argue that our experimental results indicate that the method can be applied to many realistic contracts, and that it is able to prove modularity where other methods fail.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 9 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Securing smart contract with runtime validation 引用了 Making Smart Contracts Smarter
- Securing smart contract with runtime validation 引用了 Securify: Practical Security Analysis of Smart Contracts
- Sereum: Protecting Existing Smart Contracts Against Re-Entrancy Attacks 引用了 Making Smart Contracts Smarter
- Sereum: Protecting Existing Smart Contracts Against Re-Entrancy Attacks 引用了 Securify: Practical Security Analysis of Smart Contracts
- Rich specifications for Ethereum smart contract verification 引用了 Making Smart Contracts Smarter
- Rich specifications for Ethereum smart contract verification 引用了 Securify: Practical Security Analysis of Smart Contracts
- Ethainter: a smart contract security analyzer for composite vulnerabilities 引用了 Sereum: Protecting Existing Smart Contracts Against Re-Entrancy Attacks
- Ethainter: a smart contract security analyzer for composite vulnerabilities 引用了 Making Smart Contracts Smarter
- Ethainter: a smart contract security analyzer for composite vulnerabilities 引用了 Securify: Practical Security Analysis of Smart Contracts
- Consolidating Smart Contracts with Behavioral Contracts 引用了 Securing smart contract with runtime validation
- Consolidating Smart Contracts with Behavioral Contracts 引用了 Sereum: Protecting Existing Smart Contracts Against Re-Entrancy Attacks
- Consolidating Smart Contracts with Behavioral Contracts 引用了 Rich specifications for Ethereum smart contract verification
- Consolidating Smart Contracts with Behavioral Contracts 引用了 Ethainter: a smart contract security analyzer for composite vulnerabilities
- Consolidating Smart Contracts with Behavioral Contracts 引用了 Symbolic value-flow static analysis: deep, precise, complete modeling of Ethereum smart contracts
- Symbolic value-flow static analysis: deep, precise, complete modeling of Ethereum smart contracts 引用了 Ethainter: a smart contract security analyzer for composite vulnerabilities
- Symbolic value-flow static analysis: deep, precise, complete modeling of Ethereum smart contracts 引用了 Making Smart Contracts Smarter
- Symbolic value-flow static analysis: deep, precise, complete modeling of Ethereum smart contracts 引用了 Securify: Practical Security Analysis of Smart Contracts
- FORAY: Towards Effective Attack Synthesis against Deep Logical Vulnerabilities in DeFi Protocols 引用了 Making Smart Contracts Smarter
- FORAY: Towards Effective Attack Synthesis against Deep Logical Vulnerabilities in DeFi Protocols 引用了 Securify: Practical Security Analysis of Smart Contracts
- Compositional Security for Reentrant Applications 引用了 Securing smart contract with runtime validation
- Compositional Security for Reentrant Applications 引用了 Ethainter: a smart contract security analyzer for composite vulnerabilities
- Compositional Security for Reentrant Applications 引用了 Making Smart Contracts Smarter
- Securify: Practical Security Analysis of Smart Contracts 引用了 Making Smart Contracts Smarter
引用它的顶会 Paper9
- Compositional Security for Reentrant ApplicationsEthan Cecchetti, Siqiu Yao, Haobin Ni, Andrew C. MyersS&P 2021 · 42 次引用
- Rich specifications for Ethereum smart contract verificationChristian Bräm, Marco Eilers, Peter Müller, Robin Sierra 等OOPSLA 2021 · 23 次引用
- Symbolic value-flow static analysis: deep, precise, complete modeling of Ethereum smart contractsYannis Smaragdakis, Neville Grech, Sifis Lagouvardos, Konstantinos Triantafyllou 等OOPSLA 2021 · 18 次引用
- Consolidating Smart Contracts with Behavioral ContractsGuannan Wei, Danning Xie, Wuqi Zhang, Yongwei Yuan 等PLDI 2024 · 6 次引用
- FORAY: Towards Effective Attack Synthesis against Deep Logical Vulnerabilities in DeFi ProtocolsHongbo Wen, Hanzhi Liu, Jiaxin Song, Yanju Chen 等CCS 2024 · 6 次引用
它引用的 Paper7
- Making Smart Contracts SmarterLoi Luu, Duc-Hiep Chu, Hrishi Olickel, Prateek Saxena 等CCS 2016 · 2,306 次引用
- Securify: Practical Security Analysis of Smart ContractsPetar Tsankov, Andrei Marian Dan, Dana Drachsler-Cohen, Arthur Gervais 等CCS 2018 · 1,108 次引用
- Sereum: Protecting Existing Smart Contracts Against Re-Entrancy AttacksMichael Rodler, Wenting Li, Ghassan O. Karame, Lucas DaviNDSS 2019 · 298 次引用
- Ethainter: a smart contract security analyzer for composite vulnerabilitiesLexi Brent, Neville Grech, Sifis Lagouvardos, Bernhard Scholz 等PLDI 2020 · 163 次引用
- Securing smart contract with runtime validationAo Li, Jemin Andrew Choi, Fan LongPLDI 2020 · 60 次引用
相关 Paper
- eThor: Practical and Provably Sound Static Analysis of Ethereum Smart ContractsClara Schneidewind, Ilya Grishchenko, Markus Scherer, Matteo MaffeiCCS 2020 · 9 次引用
- FairChecker: Detecting Fund-Stealing Bugs in DeFi Protocols via Fairness ValidationYi Sun, Zhuo Zhang, Xiangyu ZhangICSE 2025
- Practical Verification of Smart Contracts using Memory SplittingShelly Grossman, John Toman, Alexander Bakst, Sameer Arora 等OOPSLA 2024 · 7 次引用
- Targeted greybox fuzzing with static lookahead analysisValentin Wüstholz, Maria ChristakisICSE 2020 · 14 次引用
- Canary: practical static detection of inter-thread value-flow bugsYuandao Cai, Peisen Yao, Charles ZhangPLDI 2021 · 25 次引用
