Detecting Nondeterministic Payment Bugs in Ethereum Smart Contracts

被引:49
|
作者
Wang, Shuai [1 ]
Zhang, Chengyu [2 ]
Su, Zhendong [1 ,3 ]
机构
[1] Hong Kong Univ Sci & Technol, Hong Kong, Peoples R China
[2] East China Normal Univ, Shanghai, Peoples R China
[3] Swiss Fed Inst Technol, Zurich, Switzerland
来源
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL | 2019年 / 3卷 / OOPSLA期
关键词
Program Analysis; Smart Contracts; Security; Blockchain;
D O I
10.1145/3360615
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
The term "smart contracts" has become ubiquitous to describe an enormous number of programs uploaded to the popular Ethereum blockchain system. Despite rapid growth of the smart contract ecosystem, errors and exploitations have been constantly reported from online contract systems, which has put financial stability at risk with losses totaling millions of US dollars. Most existing research focuses on pinpointing specific types of vulnerabilities using known patterns. However, due to the lack of awareness of the inherent nondeterminism in the Ethereum blockchain system and how it affects the funds transfer of smart contracts, there can be unknown vulnerabilities that may be exploited by attackers to access numerous online smart contracts. In this paper, we introduce a methodical approach to understanding the inherent nondeterminism in the Ethereum blockchain system and its (unwanted) influence on contract payments. We show that our new focus on nondeterminism-related smart contract payment bugs captures the root causes of many common vulnerabilities without relying on any known patterns and also encompasses recently disclosed issues that are not handled by existing research. To do so, we introduce techniques to systematically model components in the contract execution context and to expose various nondeterministic factors that are not yet fully understood. We further study how these nondeterministic factors impact contract funds transfer using information flow tracking. The technical challenge of detecting nondeterministic payments lies in discovering the contract global variables subtly affected by read-write hazards because of unpredictable transaction scheduling and external callee behavior. We show how to augment and instrument a contract program into a representation that simulates the execution of a large subset of the contract behavior. The instrumented code is then analyzed to flag nondeterministic global variables using off-the-shelf model checkers. We implement the proposed techniques as a practical tool named NPCHECKER (Nondeterministic Payment Checker) and evaluate it on 30K online contracts (3,075 distinct) collected from the Ethereum mainnet. NPCHECKER has successfully detected nondeterministic payments in 1,111 online contracts with reasonable cost. Further investigation reports high precision of NPCHECKER (only four false positives in a manual study of 50 contracts). We also show that NPCHECKER unveils contracts vulnerable to recently-disclosed attack vectors. NPCHECKER can identify all six new vulnerabilities or variants of common smart contract vulnerabilities that are missed by existing research relying on a "contract vulnerability checklist."
引用
收藏
页数:29
相关论文
共 50 条
  • [1] A Framework and DataSet for Bugs in Ethereum Smart Contracts
    Zhang, Pengcheng
    Xiao, Feng
    Luo, Xiapu
    2020 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE MAINTENANCE AND EVOLUTION (ICSME 2020), 2020, : 139 - 150
  • [2] Using Ethereum Smart Contracts for Payment Transactions
    Tripkovic, Srdan
    Simic, Dejan
    SUSTAINABLE BUSINESS MANAGEMENT AND DIGITAL TRANSFORMATION: CHALLENGES AND OPPORTUNITIES IN THE POST-COVID ERA, 2023, 562 : 30 - 42
  • [3] OSIRIS: Hunting for Integer Bugs in Ethereum Smart Contracts
    Torres, Christof Ferreira
    Schuette, Julian
    State, Radu
    34TH ANNUAL COMPUTER SECURITY APPLICATIONS CONFERENCE (ACSAC 2018), 2018, : 664 - 676
  • [4] SADPonzi: Detecting and Characterizing Ponzi Schemes in Ethereum Smart Contracts
    Chen, Weimin
    Li, Xinran
    Sui, Yuting
    He, Ningyu
    Wang, Haoyu
    Wu, Lei
    Luo, Xiapu
    PROCEEDINGS OF THE ACM ON MEASUREMENT AND ANALYSIS OF COMPUTING SYSTEMS, 2021, 5 (02)
  • [5] SAFEPAY on Ethereum: A Framework For Detecting Unfair Payments in Smart Contracts
    Li, Yue
    Liu, Han
    Yang, Zhiqiang
    Ren, Qian
    Wang, Lei
    Chen, Bangdao
    2020 IEEE 40TH INTERNATIONAL CONFERENCE ON DISTRIBUTED COMPUTING SYSTEMS (ICDCS), 2020, : 1219 - 1222
  • [6] Confidential Ethereum Smart Contracts
    Yuan, Michael Juntao
    Hynes, Nick
    Long, Ju
    IT PROFESSIONAL, 2022, 24 (06) : 54 - 58
  • [7] Angels or demons: investigating and detecting decentralized financial traps on ethereum smart contracts
    Chen, Jiachi
    Hu, Jiang
    Xia, Xin
    Lo, David
    Grundy, John
    Gao, Zhipeng
    Chen, Ting
    AUTOMATED SOFTWARE ENGINEERING, 2024, 31 (02)
  • [8] VULPEDIA: Detecting vulnerable ethereum smart contracts via abstracted vulnerability signatures
    Ye, Jiaming
    Ma, Mingliang
    Lin, Yun
    Ma, Lei
    Xue, Yinxing
    Zhao, Jianjun
    JOURNAL OF SYSTEMS AND SOFTWARE, 2022, 192
  • [9] Ethereum Smart Contracts: Vulnerabilities and their Classifications
    Khan, Zulfiqar Ali
    Namin, Akbar Siami
    2020 IEEE INTERNATIONAL CONFERENCE ON BIG DATA (BIG DATA), 2020,
  • [10] Termination of Ethereum's Smart Contracts
    Genet, Thomas
    Jensen, Thomas
    Sauvage, Justine
    PROCEEDINGS OF THE 17TH INTERNATIONAL JOINT CONFERENCE ON E-BUSINESS AND TELECOMMUNICATIONS (SECRYPT), VOL 1, 2020, : 39 - 51