We present a new approach to finding smart contract vulnerabilities that is precise (no false positives up to our EVM-Yul interpreter), bounded-complete, and, when instrumented with domain knowledge, scales to real-world contracts. Our method is based on game semantics, modelling computation as an interaction between a contract and its environment, reducing reasoning about unknown or malicious external contracts to trace enumeration. We implement this in a tool we refer to as YulToolkit, a bounded game-semantics checker for Yul, the intermediate language of Solidity. By exploring only feasible interactions, YulToolkit avoids over-approximation, and by relying on the theory of game semantics it achieves bounded completeness. To make exploration tractable, YulToolkit supports instrumentation written in Solidity and propagated to Yul, comparable in effort to creating a test harness. Unlike tests, however, our technique explores all admissible traces within the chosen parameters and bounds. We evaluate YulToolkit on three real-world incidents: The DAO, PredyPool, and Lendf.Me, as well as benchmark contracts. In all cases, YulToolkit detects the known vulnerabilities (producing a violation-triggering trace), and after applying fixes, reports no further violations within bounds. These results show that bounded game semantics exploration is an effective and precise addition to the smart contract analysis toolbox, particularly for vulnerabilities such as reentrancy that are hard to detect precisely in real code.
翻译:我们提出了一种检测智能合约漏洞的新方法,该方法具有精确性(在我们的EVM-Yul解释器层面无误报)、有界完备性,并且在结合领域知识进行插装后能够扩展到实际合约。我们的方法基于博弈语义,将计算建模为合约与其环境之间的交互,从而将对未知或恶意外部合约的推理简化为迹枚举。我们在一个称为YulToolkit的工具中实现了该方法,这是一个针对Solidity中间语言Yul的有界博弈语义检查器。通过仅探索可行交互,YulToolkit避免了过度近似;依托博弈语义理论,它实现了有界完备性。为使探索可处理,YulToolkit支持用Solidity编写并传播至Yul的插装代码,其工作量与创建测试框架相当。然而与测试不同,我们的技术会在选定参数和界限内探索所有可容许的迹。我们在三个真实事件(The DAO、PredyPool和Lendf.Me)以及基准合约上评估了YulToolkit。在所有案例中,YulToolkit均检测出已知漏洞(生成触发违规的迹),且在应用修复后,在界限内未报告进一步违规。这些结果表明,有界博弈语义探索是智能合约分析工具箱中一种有效且精确的补充手段,尤其适用于重入等在实际代码中难以精确检测的漏洞类型。