Skip to main content
QUICK REVIEW

[论文解读] sFuzz: An Efficient Adaptive Fuzzer for Solidity Smart Contracts

Tai D. Nguyen, Long Hoang Pham|arXiv (Cornell University)|Apr 18, 2020
Adversarial Robustness in Machine LearningComputer Science参考文献 23被引用 43
一句话总结

sFuzz 是一种基于 AFL 的自适应模糊测试器,用于以太坊 Solidity 智能合约,它将基于种子的一次自适应搜索与轻量级多目标优化相结合,以提升代码覆盖率和漏洞发现能力,在处理超过 4,000 个合约的同时,其速度比最先进的工具快多达两个数量级。

ABSTRACT

Smart contracts are Turing-complete programs that execute on the infrastructure of the blockchain, which often manage valuable digital assets. Solidity is one of the most popular programming languages for writing smart contracts on the Ethereum platform. Like traditional programs, smart contracts may contain vulnerabilities. Unlike traditional programs, smart contracts cannot be easily patched once they are deployed. It is thus important that smart contracts are tested thoroughly before deployment. In this work, we present an adaptive fuzzer for smart contracts on the Ethereum platform called sFuzz. Compared to existing Solidity fuzzers, sFuzz combines the strategy in the AFL fuzzer and an efficient lightweight multi-objective adaptive strategy targeting those hard-to-cover branches. sFuzz has been applied to more than 4 thousand smart contracts and the experimental results show that (1) sFuzz is efficient, e.g., two orders of magnitude faster than state-of-the-art tools; (2) sFuzz is effective in achieving high code coverage and discovering vulnerabilities; and (3) the different fuzzing strategies in sFuzz complement each other.

研究动机与目标

  • 在部署前激励对 Solidity 智能合约进行彻底测试,因为它们在区块链上的不可变性。
  • 开发一个自动化测试引擎,最大化智能合约的代码覆盖率,特别是分支覆盖率。
  • 利用一种轻量级的自适应多目标种子选择策略来克服难以覆盖的分支。
  • 通过提供高效的模糊测试来补充现有的符号执行工具。
  • 通过将该方法应用于数千个合约并评估性能提升来证明可扩展性。

提出的方法

  • 采用受 AFL 启发的基于反馈的模糊测试作为核心框架,并集成面向刚刚漏失分支的自适应种子选择策略。
  • 定义一个轻量级的多目标距离基适应度来引导种子选择,关注与未覆盖分支的接近程度。
  • 将测试用例表示为位向量编码的配置和函数调用序列,便于基于遗传算子的交叉和变异。
  • 为每个刚刚漏失的分支 br_n 计算距离度量 distance(t, br_n),量化种子 t 与覆盖该分支的接近程度;为了保持效率,仅对刚刚漏失的分支简化为 distance。
  • 使用 AFL 的交叉和变异策略,结合合约特定的变异和有效性检查,以确保测试用例的语法/语义一致性。
  • 实现即时 CFG 构建和 oracle 框架(Gasless Send、Exception Disorder、Timestamp/Block/DelegateCall 漏洞、Reentrancy、Integer Overflow/Underflow、Freezing Ether)来驱动漏洞检测。

实验结果

研究问题

  • RQ1相较于现有的模糊测试工具,自适应模糊测试如何提高 Solidity 智能合约的分支覆盖率和漏洞发现能力?
  • RQ2在以太坊虚拟机约束下,哪种种子选择策略最能穿越难以覆盖的分支?
  • RQ3是否可以用轻量级、针对合约的目标有效扩展基于 AFL 的模糊测试方法以提升效率?
  • RQ4模糊测试方法在多大程度上能够补充符号执行基工具来发现智能合约漏洞?

主要发现

  • sFuzz 的平均速度比 ContractFuzzer 快上超过两个数量级。
  • sFuzz 实现了更高的代码覆盖率并发现的漏洞数多于竞争工具。
  • 自适应种子选择策略在较长时间的模糊测试运行中提高了代码覆盖率。
  • sFuzz 中不同的模糊测试策略在实际中互相补充。
  • sFuzz 已应用到超过 4,000 个智能合约,证明了可扩展性和有效性。
  • 该框架已公开可用,已被多家公司采用。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。