[论文解读] EVMPatch: Timely and Automated Patching of Ethereum Smart Contracts
EVMPatch 是一种新颖的字节码级别框架,通过重写 EVM 字节码,在无需修改源代码的情况下,实现对已部署的以太坊智能合约的自动、及时且安全的补丁修复,支持可升级且安全的版本。该框架成功修补了 14,000 个真实合约中的整数溢出/下溢和访问控制缺陷,同时保持功能正确性,并将补丁时间减少了 97.6%,证明其在生产环境中的实用性。
Recent attacks exploiting errors in smart contract code had devastating consequences thereby questioning the benefits of this technology. It is currently highly challenging to fix errors and deploy a patched contract in time. Instant patching is especially important since smart contracts are always online due to the distributed nature of blockchain systems. They also manage considerable amounts of assets, which are at risk and often beyond recovery after an attack. Existing solutions to upgrade smart contracts depend on manual and error-prone processes. This paper presents a framework, called EVMPatch, to instantly and automatically patch faulty smart contracts. EVMPatch features a bytecode rewriting engine for the popular Ethereum blockchain, and transparently/automatically rewrites common off-the-shelf contracts to upgradable contracts. The proof-of-concept implementation of EVMPatch automatically hardens smart contracts that are vulnerable to integer over/underflows and access control errors, but can be easily extended to cover more bug classes. Our extensive evaluation on 14,000 real-world (vulnerable) contracts demonstrate that our approach successfully blocks attack transactions launched on these contracts, while keeping the intended functionality of the contract intact. We perform a study with experienced software developers, showing that EVMPatch is practical, and reduces the time for converting a given Solidity smart contract to an upgradable contract by 97.6 %, while ensuring functional equivalence to the original contract.
研究动机与目标
- 解决已部署的以太坊智能合约在出现漏洞后,实现及时且自动补丁修复的关键挑战。
- 消除在合约部署后手动升级遗留合约所带来的繁琐、易出错且耗时的流程。
- 提供一种与源代码无关的、基于字节码的框架,确保功能等价性的同时支持可升级性。
- 支持对始终在线且管理高价值资产的智能合约中的零日漏洞进行快速响应。
- 与现有静态分析工具集成,并在无需准确控制流图的情况下,扩展至复杂合约。
提出的方法
- EVMPatch 采用基于跳板(trampoline)的字节码重写引擎,通过修改 EVM 字节码插入可升级逻辑,无需完整或准确的控制流图。
- 它自动将常见现成的智能合约重写为可升级版本,采用 delegatecall-Proxy 模式,通过设计确保存储布局兼容性。
- 该框架与现有静态分析工具集成,用于检测整数溢出/下溢和访问控制错误等漏洞,随后应用针对性的字节码补丁。
- 补丁在 EVM 字节码级别执行,支持任何高级语言(如 Solidity)的兼容性,避免对源代码的依赖。
- 该方法通过保留原始合约行为的同时插入运行时检查和升级机制,确保功能等价性。
- 开发者研究证实该框架具有实用性,与手动方法相比,补丁时间减少了 97.6%。
实验结果
研究问题
- RQ1基于字节码的重写框架能否在部署后自动且安全地修补有漏洞的以太坊智能合约?
- RQ2EVMPatch 在保持功能正确性的同时,对真实世界合约实现可升级性的有效性如何?
- RQ3与手动方法相比,EVMPatch 在多大程度上减少了修补智能合约所需的时间和精力?
- RQ4当缺乏准确的控制流图时,EVMPatch 对复杂合约结构的鲁棒性如何?
- RQ5EVMPatch 是否能与现有静态分析工具集成,以支持多种漏洞类别?
主要发现
- EVMPatch 已成功修补 14,000 个真实世界中存在漏洞的以太坊合约,在不破坏预期功能的前提下,阻止了所有测试的攻击交易。
- 根据开发者研究验证,与手动修补相比,EVMPatch 将将 Solidity 合约转换为可升级版本所需的时间减少了 97.6%。
- EVMPatch 与原始合约保持功能等价性,确保修补后的版本在所有测试条件下与原始版本行为完全一致。
- 基于跳板的字节码重写策略无需准确的控制流图,使其在可扩展性和鲁棒性方面优于先前方法(如 SMARTSHIELD)。
- EVMPatch 支持与多种静态分析工具集成,可扩展至整数溢出/下溢和访问控制错误之外的新漏洞类别。
- 该框架在实际部署中具有可行性,开发者反馈表明其可轻松集成到现有开发工作流中。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。