Abstract
Static analysis of smart contracts as-deployed on the Ethereum blockchain has received much recent attention. However, high-precision analyses currently face significant challenges when dealing with the Ethereum VM (EVM) execution model. A major such challenge is the modeling of low-level, transient “memory” (as opposed to persistent, on-blockchain “storage”) that smart contracts employ. Statically understanding the usage patterns of memory is non-trivial, due to the dynamic allocation nature of in-memory buffers. We offer an analysis that models EVM memory, recovering high-level concepts (e.g., arrays, buffers, call arguments) via deep modeling of the flow of values. Our analysis opens the door to Ethereum static analyses with drastically increased precision. One such analysis detects the extraction of ERC20 tokens by unauthorized users. For another practical vulnerability (redundant calls, possibly used as an attack vector), our memory modeling yields analysis precision of 89%, compared to 16% for a state-of-the-art tool without precise memory modeling. Additionally, precise memory modeling enables the static computation of a contract’s gas cost. This gas-cost analysis has recently been instrumental in the evaluation of the impact of the EIP-1884 repricing (in terms of gas costs) of EVM operations, leading to a reward and significant publicity from the Ethereum Foundation.
Supplemental Material
- Elvira Albert, Pablo Gordillo, Benjamin Livshits, Albert Rubio, and Ilya Sergey. 2018. EthIR: A Framework for High-Level Analysis of Ethereum Bytecode. In Automated Technology for Verification and Analysis (ATVA). Springer.Google Scholar
- Lexi Brent, Neville Grech, Sifis Lagouvardos, Bernhard Scholz, and Yannis Smaragdakis. 2020. Ethainter: A Smart Contract Security Analyzer for Composite Vulnerabilities. In Conf. on Programming Language Design and Implementation (PLDI). ACM.Google Scholar
- Lexi Brent, Anton Jurisevic, Michael Kong, Eric Liu, Francois Gauthier, Vincent Gramoli, Ralph Holz, and Bernhard Scholz. 2018. Vandal: A Scalable Security Analysis Framework for Smart Contracts. arXiv:cs.PL/ 1809.03981Google Scholar
- ChainSecurity. 2019. Dangerous Repeated Calls to Untrusted Contracts. https://medium.com/chainsecurity/dangerousrepeated-calls-to-untrusted-contracts-3c97d614744bGoogle Scholar
- ChainSecurity. 2020. Securify2. https://github.com/eth-sri/ securify2Google Scholar
- ConsenSys. 2020. ConsenSys Quorum. https://consensys.net/quorum/Google Scholar
- Dedaub. 2019. Contract Library. https://contract-library.com/Google Scholar
- Josselin Feist, Gustavo Greico, and Alex Groce. 2019. Slither: A Static Analysis Framework for Smart Contracts. In Proceedings of the 2Nd International Workshop on Emerging Trends in Software Engineering for Blockchain (WETSEB '19). IEEE Press, Piscataway, NJ, USA, 8-15. https://doi.org/10.1109/WETSEB. 2019.00008 Google Scholar
Digital Library
- Neville Grech, Lexi Brent, Bernhard Scholz, and Yannis Smaragdakis. 2019. Gigahorse: Thorough, Declarative Decompilation of Smart Contracts. In Proceedings of the 41st International Conference on Software Engineering (ICSE '19). IEEE Press, Piscataway, NJ, USA, 1176-1186. https://doi.org/10.1109/ICSE. 2019.00120 Google Scholar
Digital Library
- Neville Grech, Kyriakos Georgiou, James Pallister, Steve Kerrison, Jeremy Morse, and Kerstin Eder. 2015. Static Analysis of Energy Consumption for LLVM IR Programs. In Proceedings of the 18th International Workshop on Software and Compilers for Embedded Systems (SCOPES '15). ACM, New York, NY, USA, 12-21. https://doi.org/10.1145/2764967.2764974 Google Scholar
Digital Library
- Neville Grech, Michael Kong, Anton Jurisevic, Lexi Brent, Bernhard Scholz, and Yannis Smaragdakis. 2018. MadMax: Surviving Out-of-Gas Conditions in Ethereum Smart Contracts. Proc. ACM Programming Languages 2, OOPSLA (Nov. 2018 ).Google Scholar
Digital Library
- Jingxuan He, Mislav Balunović, Nodar Ambroladze, Petar Tsankov, and Martin Vechev. 2019. Learning to Fuzz from Symbolic Execution with Application to Smart Contracts. In Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security (CCS '19). ACM, New York, NY, USA, 531-548. https://doi.org/10.1145/3319535.3363230 Google Scholar
Digital Library
- E. Hildenbrandt, M. Saxena, N. Rodrigues, X. Zhu, P. Daian, D. Guth, B. Moore, D. Park, Y. Zhang, A. Stefanescu, and G. Rosu. 2018. KEVM: A Complete Formal Semantics of the Ethereum Virtual Machine. In 2018 IEEE 31st Computer Security Foundations Symposium (CSF). 204-217. https://doi.org/10.1109/CSF. 2018.00022 Google Scholar
Cross Ref
- Bo Jiang, Ye Liu, and W. K. Chan. 2018. ContractFuzzer: Fuzzing Smart Contracts for Vulnerability Detection. In Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering (ASE 2018 ). ACM, New York, NY, USA, 259-269. https://doi.org/10.1145/3238147.3238177 Google Scholar
Digital Library
- Herbert Jordan, Bernhard Scholz, and Pavle Subotić. 2016. Souflé: On Synthesis of Program Analyzers. In Computer Aided Verification, Swarat Chaudhuri and Azadeh Farzan (Eds.). Springer International Publishing, Cham, 422-430.Google Scholar
- Tomasz Kolinko. 2018. Eveem/Panoramix-Showing Contract Sources since 2018. http://eveem.org/Google Scholar
- Aashish Kolluri, Ivica Nikolic, Ilya Sergey, Aquinas Hobor, and Prateek Saxena. 2019. Exploiting the Laws of Order in Smart Contracts. In Proceedings of the 28th ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA 2019 ). ACM, New York, NY, USA, 363-373. https://doi.org/10.1145/3293882.3330560 Google Scholar
Digital Library
- Johannes Krupp and Christian Rossow. 2018. teEther: Gnawing at Ethereum to Automatically Exploit Smart Contracts. In 27th USENIX Security Symposium (USENIX Security 18). USENIX Association, Baltimore, MD, 1317-1333. https: //www.usenix.org/conference/usenixsecurity18/presentation/kruppGoogle Scholar
- Sifis Lagouvardos, Neville Grech, Ilias Tsatiris, and Yannis Smaragdakis. 2020. Precise Static Modeling of Ethereum "Memory" (artifact). https://doi.org/10.5281/zenodo.4059797 Google Scholar
Digital Library
- Adam Levi. 2019. A Technical Analysis of the Genesis Alpha Hack. https://medium.com/daostack/a-technical-analysis-ofthe-genesis-alpha-hack-f8e34433c14bGoogle Scholar
- Loi Luu, Duc-Hiep Chu, Hrishi Olickel, Prateek Saxena, and Aquinas Hobor. 2016. Making Smart Contracts Smarter. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security (CCS '16). ACM, New York, NY, USA, 254-269. https://doi.org/10.1145/2976749.2978309 Google Scholar
Digital Library
- Anastasia Mavridou and Aron Laszka. 2018. Designing Secure Ethereum Smart Contracts: A Finite State Machine Based Approach. http://aronlaszka.com/papers/mavridou2018designing.pdfGoogle Scholar
- Mark Mossberg, Felipe Manzano, Eric Hennenfent, Alex Groce, Gustavo Grieco, Josselin Feist, Trent Brunson, and Artem Dinaburg. 2019. Manticore: A User-Friendly Symbolic Execution Framework for Binaries and Smart Contracts. arXiv e-prints, Article arXiv: 1907. 03890 ( Jul 2019 ), arXiv: 1907.03890 pages. arXiv:cs.SE/ 1907.03890Google Scholar
- Bernhard Mueller. 2018. Smashing Ethereum Smart Contracts for Fun and Real Profit. https://github.com/b-mueller/ smashing-smart-contracts/raw/master/smashing-smart-contracts-1of1.pdf The 9th annual HITB Security Conference.Google Scholar
- Ivica Nikolić, Aashish Kolluri, Ilya Sergey, Prateek Saxena, and Aquinas Hobor. 2018. Finding The Greedy, Prodigal, and Suicidal Contracts at Scale. In Proceedings of the 34th Annual Computer Security Applications Conference (ACSAC '18). ACM, New York, NY, USA, 653-663. https://doi.org/10.1145/3274694.3274743 Google Scholar
Digital Library
- Anton Permenev, Dimitar Dimitrov, Petar Tsankov, Dana Drachsler-Cohen, and Martin Vechev. 2019. VerX: Safety Verification of Smart Contracts. https://files.sri.inf.ethz.ch/website/papers/sp20-verx.pdf.Google Scholar
- Yannis Smaragdakis. 2019. Next-Paradigm Programming Languages: What Will They Look like and What Changes Will They Bring?. In Proceedings of the 2019 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward! 2019 ). Association for Computing Machinery, New York, NY, USA, 187âĂŞ197. https://doi.org/10.1145/3359591.3359739 Google Scholar
Digital Library
- Martin Holst Swende. 2019. Security considerations for EIP-1884. URLomittedforanonymity,canbesearchedbasedontitleGoogle Scholar
- Petar Tsankov, Andrei Dan, Dana Drachsler-Cohen, Arthur Gervais, Florian Bünzli, and Martin Vechev. 2018. Securify: Practical Security Analysis of Smart Contracts. In Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security (CCS '18). ACM, New York, NY, USA, 67-82. https://doi.org/10.1145/3243734.3243780 Google Scholar
Digital Library
- Various. 2015. Hyperledger âĂŞÂăOpen Source Blockchain Technologies. https://www.hyperledger.org/Google Scholar
- Various. 2018. Rattle-An EVM Binary Static Analysis Framework. https://github.com/trailofbits/rattleGoogle Scholar
- Various. 2018. TRON Decentralize The Web. https://tron.network/Google Scholar
- Various. 2019. GitHub-ewasm design-metering. https://github.com/ewasm/design/blob/master/metering.mdGoogle Scholar
- Valentin WÃijstholz and Maria Christakis. 2020. Targeted Greybox Fuzzing with Static Lookahead Analysis. In International Conference on Software Engineering (ICSE).Google Scholar
Index Terms
Precise static modeling of Ethereum “memory”
Recommendations
Symbolic value-flow static analysis: deep, precise, complete modeling of Ethereum smart contracts
We present a static analysis approach that combines concrete values and symbolic expressions. This symbolic value-flow (“symvalic”) analysis models program behavior with high precision, e.g., full path sensitivity. To achieve deep modeling of program ...
Enhancing Ethereum smart-contracts static analysis by computing a precise Control-Flow Graph of Ethereum bytecode
AbstractThe immutable nature of Ethereum transactions, and consequently Ethereum smart-contracts, has stimulated the proliferation of many approaches aiming at detecting defects and security issues before the deployment of smart-contracts on ...
Highlights- Automatic extraction of precise Control-Flow Graphs from Ethereum bytecode
- ...
eThor: Practical and Provably Sound Static Analysis of Ethereum Smart Contracts
CCS '20: Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications SecurityEthereum has emerged as the most popular smart contract platform, with hundreds of thousands of contracts stored on the blockchain and covering diverse application scenarios, such as auctions, trading platforms, or elections. Given the financial nature ...






Comments