Skip to main content
QUICK REVIEW

[Paper Review] EVMPatch: Timely and Automated Patching of Ethereum Smart Contracts

Michael Rodler, Wenting Li|arXiv (Cornell University)|Oct 1, 2020
Blockchain Technology Applications and SecurityComputer Science23 references26 citations
TL;DR

EVMPatch is a novel, bytecode-level framework that enables automatic, timely, and secure patching of vulnerable Ethereum smart contracts by rewriting their EVM bytecode to support upgradable, secure versions without requiring source code changes. It successfully patches integer over/underflows and access control flaws in 14,000 real-world contracts while preserving functional correctness and reducing patching time by 97.6%, demonstrating practicality for production use.

ABSTRACT

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.

Motivation & Objective

  • To address the critical challenge of timely and automated patching of vulnerable, already-deployed Ethereum smart contracts.
  • To eliminate the manual, error-prone, and time-consuming process of upgrading legacy contracts post-deployment.
  • To provide a source-code-agnostic, bytecode-level framework that preserves functional equivalence while enabling upgradability.
  • To support rapid response to zero-day vulnerabilities in smart contracts that are always online and manage high-value assets.
  • To integrate with existing static analysis tools and scale to complex contracts without requiring accurate control-flow graphs.

Proposed method

  • EVMPatch employs a trampoline-based bytecode rewriting engine that modifies EVM bytecode to insert upgradeable logic without requiring a complete or accurate control-flow graph.
  • It automatically rewrites common off-the-shelf smart contracts into upgradable versions using the delegatecall-proxy pattern, ensuring storage layout compatibility by design.
  • The framework integrates with existing static analysis tools to detect vulnerabilities such as integer over/underflows and access control errors, then applies targeted bytecode patches.
  • Patching is performed at the EVM bytecode level, enabling compatibility with any high-level language (e.g., Solidity) and avoiding source-code dependency.
  • The approach ensures functional equivalence by preserving the original contract’s behavior while inserting runtime checks and upgrade mechanisms.
  • A developer study confirms the framework’s practicality, showing a 97.6% reduction in patching time compared to manual methods.

Experimental results

Research questions

  • RQ1Can a bytecode-level rewriting framework automatically and securely patch vulnerable Ethereum smart contracts after deployment?
  • RQ2How effective is EVMPatch in preserving functional correctness while enabling upgradability for real-world contracts?
  • RQ3To what extent can EVMPatch reduce the time and effort required to patch smart contracts compared to manual methods?
  • RQ4How resilient is EVMPatch to complex contract structures, especially when accurate control-flow graphs are unavailable?
  • RQ5Can EVMPatch be integrated with existing static analysis tools to support multiple vulnerability classes?

Key findings

  • EVMPatch successfully patched 14,000 real-world vulnerable Ethereum contracts, blocking all tested attack transactions without breaking intended functionality.
  • The framework reduced the time required to convert a Solidity contract into an upgradable version by 97.6% compared to manual patching, as validated in a developer study.
  • EVMPatch maintains functional equivalence with the original contracts, ensuring that patched versions behave identically to the original under all test conditions.
  • The trampoline-based bytecode rewriting strategy does not require an accurate control-flow graph, making it more scalable and robust than prior approaches like SMARTSHIELD.
  • EVMPatch supports integration with multiple static analysis tools, enabling extension to new vulnerability classes beyond integer over/underflows and access control errors.
  • The framework is practical for real-world deployment, as confirmed by developer feedback indicating ease of integration into existing development workflows.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.