Skip to main content
QUICK REVIEW

[论文解读] Formalising and verifying smart contracts with Solidifier: a bounded model checker for Solidity

Pedro Antonino, A. W. Roscoe|arXiv (Cornell University)|Feb 7, 2020
Security and Verification in Computing参考文献 38被引用 9
一句话总结

本文提出 Solidifier,一种针对 Solidity 的有界模型检测工具,通过 Solid 语言形式化描述 Solidity 的核心子集,并将其转换为 Boogie 以利用 Corral 进行验证。该工具通过系统性地探索至指定深度的执行路径,能够精确检测语义属性违规(如内存别名和存储布局问题),在精度和语义保真度方面优于现有工具,同时保持了具有竞争力的性能。

ABSTRACT

The exploitation of smart-contract vulnerabilities can have catastrophic consequences such as the loss of millions of pounds worth of crypto assets. Formal verification can be a useful tool in identifying vulnerabilities and proving that they have been fixed. In this paper, we present a formalisation of Solidity and the Ethereum blockchain using the Solid language and its blockchain; a Solid program is obtained by explicating/desugaring a Solidity program. We make some abstractions that over-approximate the way in which Solidity/Ethereum behave. Based on this formalisation, we create Solidifier: a bounded model checker for Solidity. It translates Solid into Boogie, an intermediate verification language, that is later verified using Corral, a bounded model checker for Boogie. Unlike much of the work in this area, we do not try to find specific behavioural/code patterns that might lead to vulnerabilities. Instead, we provide a tool to find errors/bad states, i.e. program states that do not conform with the intent of the developer. Such a bad state, be it a vulnerability or not, might be reached through the execution of specific known code patterns or through behaviours that have not been anticipated.

研究动机与目标

  • 为应对智能合约验证中因代码漏洞导致灾难性财务损失的迫切需求。
  • 为 Solidity 的代表性子集提供形式化的语义基础,抽象掉底层复杂性,同时保留关键行为。
  • 开发一种能够检测语义属性违规的工具,而非依赖基于模式的漏洞检测。
  • 通过忠实建模 Solidity 的非传统内存模型和存储布局,提高形式化验证的准确性。
  • 在精度、速度和语义保真度方面,对 Solidifier 与现有工具进行评估。

提出的方法

  • 使用 Solid 语言形式化描述 Solidity 的核心子集,该语言通过去糖化和简化 Solidity 构造,使语义更加清晰。
  • 将 Solid 程序转换为 Boogie,一种中间验证语言,以支持形式化推理。
  • 使用 Corral,一个 Boogie 的有界模型检查器,对用户定义深度内的所有执行路径进行符号化探索。
  • 特别关注地编码 Solidity 的内存模型和存储布局,以捕捉别名和确定性布局行为。
  • 定义用户指定的语义属性(例如不变式、安全条件),在模型检查过程中检测其违规。
  • 为 Corral 配置定制化参数,以在探索深度与性能之间取得平衡,同时最小化误报。

实验结果

研究问题

  • RQ1在简化语言(Solid)中对 Solidity 语义进行形式化,是否能比基于 EVM 的低层方法实现更精确的验证?
  • RQ2Solidifier 在检测语义属性违规方面,与 Mythril、VeriSol 和 solc-verify 等现有工具相比,其精度如何?
  • RQ3Solidifier 在多大程度上忠实捕捉了 Solidity 的内存模型和存储布局语义?
  • RQ4在实践中,使用小范围的有界模型检查是否足以检测常见智能合约错误?
  • RQ5用户定义的语义属性是否能揭示超出已知代码模式的漏洞?

主要发现

  • Solidifier 在精度方面优于 solc-verify,由于对 Solidity 语义的 Boogie 编码更准确,因此报告的误报更少。
  • Solidifier 在性能上与 VeriSol 等其他基于 Boogie 的工具相当,同时在语义保真度方面表现更优,尤其在捕捉别名和存储布局行为方面。
  • 该工具在仅调用少数函数的情况下,成功检测到 Aliasing 和 StorageDeterministicLayout 基准测试中的违规,表明使用小范围边界的有界模型检查对常见错误是有效的。
  • 评估表明,Solidifier 的方法——即形式化高层语义并验证用户定义的属性——相比基于模式的符号执行或过度近似验证,能产生更可靠的验证结果。
  • 结果表明,Solidifier 对 Solidity 内存模型的建模比其他工具更忠实,这体现在其能正确检测到细微的别名和布局相关问题。
  • Solidifier 的验证速度与其他工具相当,表明高精度验证无需以性能为代价。

更好的研究,从现在开始

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

无需绑定信用卡

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