[论文解读] Precise Attack Synthesis for Smart Contracts
SmartScopy 是一种新颖的系统,可自动合成精准利用目标智能合约漏洞的对抗性智能合约。它采用基于摘要的符号执行,在避免路径爆炸的同时保持高精度,从而实现高效、可扩展且安全的真正利用检测——已成功在现有工具难以触及的真实以太坊合约中,发现20个此前未被检测到的 BatchOverflow 漏洞。
Smart contracts are programs running on top of blockchain platforms. They interact with each other through well-defined interfaces to perform financial transactions in a distributed system with no trusted third parties. But these interfaces also provide a favorable setting for attackers, who can exploit security vulnerabilities in smart contracts to achieve financial gain. This paper presents SmartScopy, a system for automatic synthesis of adversarial contracts that identify and exploit vulnerabilities in a victim smart contract. Our tool explores the space of \emph{attack programs} based on the Application Binary Interface (ABI) specification of a victim smart contract in the Ethereum ecosystem. To make the synthesis tractable, we introduce \emph{summary-based symbolic evaluation}, which significantly reduces the number of instructions that our synthesizer needs to evaluate symbolically, without compromising the precision of the vulnerability query. Building on the summary-based symbolic evaluation, SmartScopy further introduces a novel approach for partitioning the synthesis search space for parallel exploration, as well as a lightweight deduction technique that can prune infeasible candidates earlier. We encoded common vulnerabilities of smart contracts in our query language, and evaluated SmartScopy on the entire data set from etherscan with $>$25K smart contracts. Our experiments demonstrate the benefits of summary-based symbolic evaluation and show that SmartScopy outperforms two state-of-the-art smart contracts analyzers, Oyente and Contractfuzz, in terms of running time, precision, and soundness. Furthermore, running on recent popular smart contracts, SmartScopy uncovers 20 vulnerable smart contracts that contain the recent BatchOverflow vulnerability and cannot be precisely detected by existing tools.
研究动机与目标
- 为解决智能合约中真实可利用漏洞检测这一关键挑战,此类漏洞具有不可变性,可能导致灾难性财务损失。
- 克服现有符号执行和静态分析工具在可扩展性和精度方面的局限,这些工具往往过度近似或无法生成实际攻击合约。
- 实现对抗性合约的自动合成,真实复现以太坊虚拟机(EVM)环境,包括存储、Gas 和 Keccak-256 哈希运算。
- 提升对细微、现实世界中漏洞(如 BatchOverflow)的检测能力,这些漏洞因分析不精确或依赖随机输入生成而被当前工具遗漏。
- 提供一种可扩展、高精度且高效的漏洞利用框架,与现有静态分析器形成互补。
提出的方法
- SmartScopy 使用基于摘要的符号评估,预先计算并存储目标合约中每个公开函数的副作用,显著减少在合成过程中需要符号探索的路径数量。
- 通过在符号变量取值范围上进行案例拆分,对合成搜索空间进行划分,利用基于 SMT 的符号执行引擎并行探索候选攻击程序。
- 系统采用轻量级的归纳推理技术,基于抽象语义在合成过程早期剔除不可行的攻击候选,提升效率。
- 利用以太坊合约的应用二进制接口(ABI)建模函数调用与交互,确保对 EVM 执行环境的精确模拟。
- 该工具支持一种声明式查询语言,允许安全分析师将常见漏洞(如重入攻击、BatchOverflow)形式化为模式,实现自动化利用生成。
- 它与 Vandal 的中间表示(IR)集成,用于分析 EVM 字节码,因此独立于原始高级语言(如 Solidity)。
实验结果
研究问题
- RQ1基于摘要的符号执行能否实现对真实漏洞的精确且可扩展的对抗性智能合约合成?
- RQ2在检测已知漏洞(如重入攻击和 BatchOverflow)时,SmartScopy 的方法在精度、正确性和性能方面与现有工具相比如何?
- RQ3SmartScopy 在多大程度上能够发现现实世界智能合约中此前未被检测到的漏洞,而这些漏洞被当前的静态分析和模糊测试工具所遗漏?
- RQ4该系统能否在不引发路径爆炸的前提下,高效处理涉及 Keccak-256 哈希运算和存储操作的复杂交互?
- RQ5搜索空间划分与早期剪枝的结合在提升利用合成可扩展性方面有多高效?
主要发现
- SmartScopy 在运行时间和精度方面均优于两项最先进工具 Oyente 和 ContractFuzzer,得益于优化的符号执行与剪枝策略,性能显著提升。
- 该系统成功检测到20个此前未知的 BatchOverflow 漏洞实例,存在于近期广泛部署的以太坊合约中——这些漏洞被现有工具精确识别失败。
- 基于摘要的符号评估在减少需探索路径数的同时保持了完整精度,使工具能够扩展至大型合约而无需牺牲准确性。
- 通过采用案例拆分与基于抽象语义的剪枝,SmartScopy 实现了多个攻击候选的并行探索,显著提升了搜索效率。
- SmartScopy 的查询语言表达能力足够强大,可编码广泛常见的智能合约漏洞,包括重入攻击、整数溢出和存储访问缺陷。
- 该工具与现有静态分析器(如 Securify)具有互补性:可为被标记为存在漏洞的合约生成真实利用代码,从而增强静态分析的实际应用价值。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。