Ethereum is a permissionless blockchain ecosystem that supports execution of smart contracts, the key enablers of decentralized finance (DeFi) and non-fungible tokens (NFT). However, the expressiveness of Ethereum smart contracts is a double-edged sword: while it enables blockchain programmability, it also introduces security vulnerabilities, i.e., the exploitable discrepancies between expected and actual behaviors of the contract code. To address these discrepancies and increase the vulnerability coverage, we propose a new smart contract security testing approach called transaction encapsulation. The core idea lies in the local execution of transactions on a fully-synchronized yet isolated Ethereum node, which creates a preview of outcomes of transaction sequences on the current state of blockchain. This approach poses a critical technical challenge -- the well-known time-of-check/time-of-use (TOCTOU) problem, i.e., the assurance that the final transactions will exhibit the same execution paths as the encapsulated test transactions. In this work, we determine the exact conditions for guaranteed execution path replicability of the tested transactions, and implement a transaction testing tool, TxT, which reveals the actual outcomes of Ethereum transactions. To ensure the correctness of testing, TxT deterministically verifies whether a given sequence of transactions ensues an identical execution path on the current state of blockchain. We analyze over 1.3 billion Ethereum transactions and determine that 96.5% of them can be verified by TxT. We further show that TxT successfully reveals the suspicious behaviors associated with 31 out of 37 vulnerabilities (83.8% coverage) in the smart contract weakness classification (SWC) registry. In comparison, the vulnerability coverage of all the existing defense approaches combined only reaches 40.5%.
翻译:Eiterum是一个没有许可的连锁生态系统,它支持执行智能合同、分散化金融(DeFi)和不易变现的象征(NFT)的关键推动者。然而,Etheum智能合同的清晰度是一把双刃剑:虽然它能够实现连锁程序,但它也带来了安全脆弱性,即合同代码的预期行为和实际行为之间的可利用差异。为了解决这些差异并增加脆弱性覆盖面,我们提议了一种新的智能合同安全测试方法,称为交易封套。核心理念在于完全同步但孤立的 Eexeum 节点上进行交易的本地执行。然而,Etheenum智能智能智能合同的清晰度预示力是一种双刃剑剑剑剑剑剑剑剑剑剑桥:这个方法提出了关键的技术挑战,即众所周知的检查/使用时间(TOTOOU)问题。为了解决这些差异,我们提议最终交易只能显示与包装测试交易的所有脆弱性方法相同的执行路径。在这项工作中,我们确定保证测试交易执行路径的准确性可复制性,而我们确定测试的智能交易的正确性交易范围。