Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1109/ICSE.2019.00120acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
research-article

Gigahorse: thorough, declarative decompilation of smart contracts

Published: 25 May 2019 Publication History

Abstract

The rise of smart contracts---autonomous applications running on blockchains---has led to a growing number of threats, necessitating sophisticated program analysis. However, smart contracts, which transact valuable tokens and cryptocurrencies, are compiled to very low-level bytecode. This bytecode is the ultimate semantics and means of enforcement of the contract.
We present the Gigahorse toolchain. At its core is a reverse compiler (i.e., a decompiler) that decompiles smart contracts from Ethereum Virtual Machine (EVM) bytecode into a high-level 3-address code representation. The new intermediate representation of smart contracts makes implicit data- and control-flow dependencies of the EVM bytecode explicit. Decompilation obviates the need for a contract's source and allows the analysis of both new and deployed contracts.
Gigahorse advances the state of the art on several fronts. It gives the highest analysis precision and completeness among decompilers for Ethereum smart contracts---e.g., Gigahorse can decompile over 99.98% of deployed contracts, compared to 88% for the recently-published Vandal decompiler and under 50% for the state-of-the-practice Porosity decompiler. Importantly, Gigahorse offers a full-featured toolchain for further analyses (and a "batteries included" approach, with multiple clients already implemented), together with the highest performance and scalability. Key to these improvements is Gigahorse's use of a declarative, logic-based specification, which allows high-level insights to inform low-level decompilation.

References

[1]
Elvira Albert, Pablo Gordillo, Benjamin Livshits, Albert Rubio, and Ilya Sergey. Ethir: A framework for high-level analysis of ethereum bytecode. In Automated Technology for Verification and Analysis (ATVA). Springer, 2018.
[2]
Massimo Bartoletti, Salvatore Carta, Tiziana Cimoli, and Roberto Saia. Dissecting ponzi schemes on ethereum: identification, analysis, and impact, 2017.
[3]
Karthikeyan Bhargavan, Antoine Delignat-Lavaud, Cédric Fournet, Anitha Gollamudi, Georges Gonthier, Nadim Kobeissi, Natalia Kulatova, Aseem Rastogi, Thomas Sibut-Pinote, Nikhil Swamy, and Santiago Zanella-Béguelin. Formal verification of smart contracts: Short paper. In Proceedings of the 2016 ACM Workshop on Programming Languages and Analysis for Security, PLAS '16, pages 91--96, New York, NY, USA, 2016. ACM.
[4]
Martin Bravenboer and Yannis Smaragdakis. Strictly declarative specification of sophisticated points-to analyses. In submission to OOPSLA '09: 24th annual ACM SIGPLAN conference on Object Oriented Programming, Systems, Languages, and Applications, New York, NY, USA, 2009. ACM.
[5]
T. Chen, X. Li, X. Luo, and X. Zhang. Under-optimized smart contracts devour your money. In 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER), pages 442--446, Feb 2017.
[6]
Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst., 13(4):451--490, October 1991.
[7]
Michael Eichberg, Sven Kloppenburg, Karl Klose, and Mira Mezini. Defining and continuous checking of structural program dependencies. In ICSE '08: Proceedings of the 30th International Conference on Software Engineering, pages 391--400, New York, NY, USA, 2008. ACM.
[8]
Miguel Gómez-Zamalloa, Elvira Albert, and Germán Puebla. Decompilation of java bytecode to prolog by partial evaluation. Inf. Softw. Technol., 51(10):1409--1427, October 2009.
[9]
Neville Grech, Michael Kong, Anton Jurisevic, Lexi Brent, Bernhard Scholz, and Yannis Smaragdakis. Madmax: Surviving out-of-gas conditions in ethereum smart contracts. Proc. ACM Programming Languages, 2(OOPSLA):to appear, November 2018.
[10]
Shelly Grossman, Ittai Abraham, Guy Golan-Gueta, Yan Michalevsky, Noam Rinetzky, Mooly Sagiv, and Yoni Zohar. Online detection of effectively callback free objects with applications to smart contracts. Proc. ACM Programming Languages, 2(POPL):48:1--48:28, December 2017.
[11]
Elnar Hajiyev, Mathieu Verbaere, and Oege de Moor. Codequest: Scalable source code queries with Datalog. In ECOOP'06: Proceedings of the 20th European Conference on Object-Oriented Programming, pages 2--27. Spinger, 2006.
[12]
James Hamilton and Sebastian Danicic. An evaluation of current java bytecode decompilers. In Proceedings of the 2009 Ninth IEEE International Working Conference on Source Code Analysis and Manipulation, SCAM '09, pages 129--136, Washington, DC, USA, 2009. IEEE Computer Society.
[13]
Herbert Jordan, Bernhard Scholz, and Pavle Subotić. Soufflé: On synthesis of program analyzers. In Swarat Chaudhuri and Azadeh Farzan, editors, Computer Aided Verification, pages 422--430, Cham, 2016. Springer International Publishing.
[14]
Sukrit Kalra, Seep Goel, Seep Goel, and Subodh Sharma. Zeus: Analyzing safety of smart contracts, 2018.
[15]
Tomasz Kolinko. Eveem/Panoramix - Showing Contract Sources since 2018, 2018. Accessed: 2019-02-15.
[16]
Monica S. Lam, John Whaley, V. Benjamin Livshits, Michael C. Martin, Dzintars Avots, Michael Carbin, and Christopher Unkel. Context-sensitive program analysis as database queries. In Proc. of the 24th Symp. on Principles of Database Systems, PODS '05, pages 1--12, New York, NY, USA, 2005. ACM.
[17]
Tim Lindholm, Frank Yellin, Gilad Bracha, and Alex Buckley. The Java Virtual Machine Specification, Java SE 8 Edition. Addison-Wesley Professional, 1st edition, 2014.
[18]
Loi Luu, Duc-Hiep Chu, Hrishi Olickel, Prateek Saxena, and Aquinas Hobor. Making smart contracts smarter. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, CCS '16, pages 254--269, New York, NY, USA, 2016. ACM.
[19]
Magnus Madsen, Benjamin Livshits, and Michael Fanning. Practical static analysis of JavaScript applications in the presence of frameworks and libraries. In Proceedings of the ACM SIGSOFT International Symposium on the Foundations of Software Engineering, August 2013.
[20]
Anastasia Mavridou and Aron Laszka. Designing secure ethereum smart contracts: A finite state machine based approach, 2018.
[21]
Jerome Miecznikowski and Laurie J. Hendren. Decompiling java bytecode: Problems, traps and pitfalls. In Proceedings of the 11th International Conference on Compiler Construction, CC '02, pages 111--127, London, UK, UK, 2002. Springer-Verlag.
[22]
Bernhard Mueller. Smashing ethereum smart contracts for fun and real profit, 2018. The 9th annual HITB Security Conference.
[23]
Mayur Naik, Alex Aiken, and John Whaley. Effective static race detection for java. In Proc. of the 2006 ACM SIGPLAN Conf. on Programming Language Design and Implementation, PLDI '06, pages 308--319, New York, NY, USA, 2006. ACM.
[24]
Mayur Naik, Chang-Seo Park, Koushik Sen, and David Gay. Effective static deadlock detection. In Proc. of the 31st International Conf. on Software Engineering, ICSE '09, pages 386--396, New York, NY, USA, 2009. ACM.
[25]
Ivica Nikolic, Aashish Kolluri, Ilya Sergey, Prateek Saxena, and Aquinas Hobor. Finding the greedy, prodigal, and suicidal contracts at scale. CoRR, abs/1802.06038, 2018.
[26]
Todd A. Proebsting and Scott A. Watterson. Krakatoa: Decompilation in Java (does bytecode reveal source?). In Proceedings of the 3rd Conference on USENIX Conference on Object-Oriented Technologies (COOTS) - Volume 3, COOTS'97, pages 14--14, Berkeley, CA, USA, 1997. USENIX Association.
[27]
Thomas Reps. Demand interprocedural program analysis using logic databases. In R. Ramakrishnan, editor, Applications of Logic Databases, pages 163--196. Kluwer Academic Publishers, 1994.
[28]
Yannis Smaragdakis and George Balatsouras. Pointer analysis. Foundations and Trends in Programming Languages, 2(1):1--69, 2015.
[29]
Yannis Smaragdakis, George Kastrinis, and George Balatsouras. Introspective analysis: Context-sensitivity, across the board. In Proc. of the 2014 ACM SIGPLAN Conf. on Programming Language Design and Implementation, PLDI '14, pages 485--495, New York, NY, USA, 2014. ACM.
[30]
Various. Eip 214 - new opcode staticcall. https://github.com/ethereum/EIPs/blob/master/EIPS/eip-214.md. Accessed: 2018-08-15.
[31]
Various. Ethereum function signature database. https://www.4byte.directory/. Accessed: 2018-08-15.
[32]
Various. JODE - Java Optimize and Decompile Environment, 2018. Accessed: 2018-08-24.
[33]
Various. Porosity - a decompiler for EVM bytecode into readable Solidity-syntax contracts, 2018. Accessed: 2018-08-24.
[34]
Various. Rattle - An EVM Binary Static Analysis Framework, 2018. Accessed: 2018-08-24.
[35]
Various. Vandal - A Static Analysis Framework for Ethereum Bytecode, 2018. Accessed: 2018-07-30.
[36]
John Whaley, Dzintars Avots, Michael Carbin, and Monica S. Lam. Using Datalog with binary decision diagrams for program analysis. In Proc. of the 3rd Asian Symposium on Programming Languages and Systems, pages 97--118, 2005.

Cited By

View all
  • (2024)COBRA: Interaction-Aware Bytecode-Level Vulnerability Detector for Smart ContractsProceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering10.1145/3691620.3695601(1358-1369)Online publication date: 27-Oct-2024
  • (2024)Practical Verification of Smart Contracts using Memory SplittingProceedings of the ACM on Programming Languages10.1145/36897968:OOPSLA2(2402-2433)Online publication date: 8-Oct-2024
  • (2024)Making Formulog Fast: An Argument for Unconventional Datalog EvaluationProceedings of the ACM on Programming Languages10.1145/36897548:OOPSLA2(1219-1248)Online publication date: 8-Oct-2024
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
ICSE '19: Proceedings of the 41st International Conference on Software Engineering
May 2019
1318 pages

Sponsors

Publisher

IEEE Press

Publication History

Published: 25 May 2019

Check for updates

Badges

Author Tags

  1. blockchain
  2. decompilation
  3. ethereum
  4. program analysis

Qualifiers

  • Research-article

Conference

ICSE '19
Sponsor:

Acceptance Rates

Overall Acceptance Rate 276 of 1,856 submissions, 15%

Upcoming Conference

ICSE 2025

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)20
  • Downloads (Last 6 weeks)2
Reflects downloads up to 18 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2024)COBRA: Interaction-Aware Bytecode-Level Vulnerability Detector for Smart ContractsProceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering10.1145/3691620.3695601(1358-1369)Online publication date: 27-Oct-2024
  • (2024)Practical Verification of Smart Contracts using Memory SplittingProceedings of the ACM on Programming Languages10.1145/36897968:OOPSLA2(2402-2433)Online publication date: 8-Oct-2024
  • (2024)Making Formulog Fast: An Argument for Unconventional Datalog EvaluationProceedings of the ACM on Programming Languages10.1145/36897548:OOPSLA2(1219-1248)Online publication date: 8-Oct-2024
  • (2024)VarLifter: Recovering Variables and Types from Bytecode of Solidity Smart ContractsProceedings of the ACM on Programming Languages10.1145/36897118:OOPSLA2(1-29)Online publication date: 8-Oct-2024
  • (2024)Bytecode Ponzi Contract Detection Based on Cross-modal Mutual LearningProceedings of the 5th International Conference on Computer Information and Big Data Applications10.1145/3671151.3671317(948-956)Online publication date: 26-Apr-2024
  • (2024)SoK: A Unified Data Model for Smart Contract Vulnerability TaxonomiesProceedings of the 19th International Conference on Availability, Reliability and Security10.1145/3664476.3664507(1-13)Online publication date: 30-Jul-2024
  • (2024)Synthesis of Sound and Precise Storage Cost Bounds via Unsound Resource Analysis and Max-SMTProceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3650212.3680352(1186-1197)Online publication date: 11-Sep-2024
  • (2024)Midas: Mining Profitable Exploits in On-Chain Smart Contracts via Feedback-Driven Fuzzing and Differential AnalysisProceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3650212.3680321(794-805)Online publication date: 11-Sep-2024
  • (2024)Finding Cross-Rule Optimization Bugs in Datalog EnginesProceedings of the ACM on Programming Languages10.1145/36498158:OOPSLA1(110-136)Online publication date: 29-Apr-2024
  • (2024)Stop Pulling my Rug: Exposing Rug Pull Risks in Crypto Token to InvestorsProceedings of the 46th International Conference on Software Engineering: Software Engineering in Practice10.1145/3639477.3639722(228-239)Online publication date: 14-Apr-2024
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media