arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2301.03943cs.CRcs.PLcs.SE
收藏

重新思考智能合约Fuzzing:使用调用排序和重要分支重访的Fuzzing

Rethinking Smart Contract Fuzzing: Fuzzing With Invocation Ordering and Important Branch Revisiting

Zhenguang Liu, Peng Qian, Jiaxu Yang, Lingfeng Liu, Xiaojun Xu, Qinming He, Xiaosong Zhang

摘要:

区块链智能合约已经产生了各种有趣和引人注目的应用程序,并成为互联网的革命性力量。不少从业者致力于开发检测智能合约中bug的工具。一种努力是围绕静态分析技术,这种技术严重地受到高假阳性率的影响。另一系列的工作集中在模糊技术。不幸的是,目前智能合约的模糊方法倾向于从合约的初始状态开始进行模糊,这会花费太多的能量围绕初始状态,因此通常无法发现其他状态触发的错误。此外,大多数现有的方法平等地对待每个分支,未能照顾到那些罕见的或更有可能拥有bug的分支。这可能会导致资源浪费在普通分支上。在本文中,我们试图从三个方面来解决这些挑战:(1)在生成函数调用序列时,我们显式地考虑函数之间的数据依赖关系,以便于探索更丰富的状态。我们通过附加一个新的序列S2来进一步延长函数调用序列S1,这样S2就可以从不同于初始状态的状态开始模糊化。(2)我们采用了一个分支距离为基础的措施,不断发展的测试用例迭代向目标分支。(3)我们采用分支搜索算法来发现稀有和脆弱的分支,并设计一个能量分配机制来处理这些关键分支。我们实现了IR-Fuzz,并在12 K个真实世界的合同中对其进行了广泛的评估。实证结果表明:(i)IR-Fuzz比最先进的模糊方法实现了高28%的分支覆盖率,(ii)IR-Fuzz检测到更多的漏洞,并将漏洞检测的平均准确性提高了7%。

英文摘要:

Blockchain smart contracts have given rise to a variety of interesting and compelling applications and emerged as a revolutionary force for the Internet. Quite a few practitioners have devoted themselves to developing tools for detecting bugs in smart contracts. One line of efforts revolve around static analysis techniques, which heavily suffer from high false-positive rates. Another line of works concentrate on fuzzing techniques. Unfortunately, current fuzzing approaches for smart contracts tend to conduct fuzzing starting from the initial state of the contract, which expends too much energy revolving around the initial state and thus is usually unable to unearth bugs triggered by other states. Moreover, most existing methods treat each branch equally, failing to take care of the branches that are rare or more likely to possess bugs. This might lead to resources wasted on normal branches. In this paper, we try to tackle these challenges from three aspects: (1) In generating function invocation sequences, we explicitly consider data dependencies between functions to facilitate exploring richer states. We further prolong a function invocation sequence S1 by appending a new sequence S2, so that S2 can start fuzzing from states that are different from the initial state. (2) We incorporate a branch distance-based measure to evolve test cases iteratively towards a target branch. (3) We engage a branch search algorithm to discover rare and vulnerable branches, and design an energy allocation mechanism to take care of exercising these crucial branches. We implement IR-Fuzz and extensively evaluate it over 12K real-world contracts. Empirical results show that: (i) IR-Fuzz achieves 28% higher branch coverage than state-of-the-art fuzzing approaches, and (ii) IR-Fuzz detects more vulnerabilities and increases the average accuracy of vulnerability detection by 7% over current methods.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑