Skip to main content
QUICK REVIEW

[论文解读] Hunting for Re-Entrancy Attacks in Ethereum Smart Contracts via Static Analysis

Yuichiro Chinen, Naoto Yanai|arXiv (Cornell University)|Jul 2, 2020
Blockchain Technology Applications and Security参考文献 26被引用 4
一句话总结

本文提出 RA,一种静态分析工具,通过在 EVM 字节码上使用符号执行和 SMT 求解,检测以太坊智能合约中的重入漏洞。该工具能精确识别漏洞,无误报或漏报,无需事先了解攻击模式,并且仅基于已部署的合约字节码运行,无需执行交易。

ABSTRACT

Ethereum smart contracts are programs that are deployed and executed in a consensus-based blockchain managed by a peer-to-peer network. Several re-entrancy attacks that aim to steal Ether, the cryptocurrency used in Ethereum, stored in deployed smart contracts have been found in the recent years. A countermeasure to such attacks is based on dynamic analysis that executes the smart contracts themselves, but it requires the spending of Ether and knowledge of attack patterns for analysis in advance. In this paper, we present a static analysis tool named extit{RA (Re-entrancy Analyzer)}, a combination of symbolic execution and equivalence checking by a satisfiability modulo theories solver to analyze smart contract vulnerabilities to re-entrancy attacks. In contrast to existing tools, RA supports analysis of inter-contract behaviors by using only the Etherum Virtual Machine bytecodes of target smart contracts, i.e., even without prior knowledge of attack patterns and without spending Ether. Furthermore, RA can verify existence of vulnerabilities to re-entrancy attacks without execution of smart contracts and it does not provide false positives and false negatives. We also present an implementation of RA to evaluate its performance in analyzing the vulnerability of deployed smart contracts to re-entrancy attacks and show that RA can precisely determine which smart contracts are vulnerable.

研究动机与目标

  • 解决在无需源代码或执行的情况下,对已部署以太坊智能合约进行安全、精确分析的迫切需求。
  • 克服动态分析的局限性,后者需要消耗以太币并依赖对攻击模式的先验知识。
  • 通过形式化验证技术,消除重入漏洞检测中的误报和漏报。
  • 仅使用 EVM 字节码实现跨合约静态分析,确保与已发布和未发布的合约兼容。
  • 提供一种可扩展、准确且自动化的解决方案,用于识别现实世界智能合约中的前沿重入攻击。

提出的方法

  • RA 使用符号执行构建跨合约控制流图(CFG),以模拟多个合约之间的重入行为。
  • 它对对外部合约调用进行符号化建模,保留状态转换和潜在的重入点。
  • 该工具使用 Z3 SMT 求解器,通过检查从控制流和状态变化中推导出的约束条件的可满足性,正式验证是否存在重入漏洞。
  • 通过 SMT 求解进行等价性检查,分析合约是否在状态更新前可被重入,从而实现漏洞检测。
  • 该方法仅基于 EVM 字节码运行,使得即使在缺乏源代码的情况下也能分析合约。
  • RA 将符号执行与基于 SMT 的等价性检查相结合,确保漏洞检测的可靠性和完备性。

实验结果

研究问题

  • RQ1是否可以仅使用 EVM 字节码,以零误报和零漏报的方式检测以太坊智能合约中的重入漏洞?
  • RQ2是否可以使用静态分析工具检测现有工具无法识别的高级重入攻击,且无需事先了解攻击模式?
  • RQ3是否可能通过在 EVM 字节码上使用符号执行和 SMT 求解,实现对智能合约的精确跨合约分析?
  • RQ4所提出方法在识别已部署合约中真实存在的重入漏洞方面效果如何?
  • RQ5该工具是否能够扩展到检测复杂、多对多合约交互场景中的漏洞?

主要发现

  • RA 以 100% 的精度成功检测到现实世界以太坊智能合约中的重入漏洞,未报告任何误报或漏报。
  • 即使在依赖复杂跨合约调用模式、传统符号执行工具难以识别的情况下,该工具仍能准确识别出存在漏洞的合约。
  • RA 的分析完全基于 EVM 字节码,使得即使在合约源代码未公开的情况下也能检测漏洞。
  • 符号执行与 Z3 SMT 求解的集成使 RA 能够在不执行交易的情况下,正式验证重入缺陷的存在。
  • 对已部署合约的评估证实,RA 能够精确区分存在漏洞和不存在漏洞的合约。
  • RA 的设计具有可扩展性,可被适配以检测其他类型的漏洞,例如利用区块时间戳的时间依赖性攻击。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。