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.”
Fri 25 Oct
|11:00 - 11:22|
Shuai WangHong Kong University of Science and Technology, Chengyu ZhangEast China Normal University, Zhendong SuETH ZurichDOI
|11:22 - 11:45|
Rong PanUniversity of Texas at Austin, Qinheping HuUniversity of Wisconsin, Madison, Gaowei XuUniversity of Wisconsin Madison, Loris D'AntoniUniversity of Wisconsin MadisonDOI Pre-print
|11:45 - 12:07|
Johannes BaderFacebook, Andrew ScottFacebook, Michael PradelUniversity of Stuttgart, Satish ChandraFacebookDOI Pre-print
|12:07 - 12:30|
Bo ShenPeking University, Wei ZhangPeking University, Haiyan ZhaoPeking University, Guangtai LiangHuawei Technologies Co. Ltd, Zhi JinPeking University, Qianxiang WangHuawei Technologies Co. LtdDOI