🔁nonReentrant Vulnerability in EigenLayer Withdrawals

Overview of the Vulnerability

In decentralized systems, reentrancy vulnerabilities are a common security concern. Reentrancy occurs when a contract's function is called while it is still in execution, potentially allowing malicious actors to manipulate the state or perform unintended actions. While the nonReentrant modifier is used to protect against reentrancy attacks, there are scenarios where reentrancy is necessary for the proper functioning of a contract, especially in the context of cross-chain operations or complex workflows like EigenLayer withdrawals.

This type of vulnerability arises when the nonReentrant modifier is applied too broadly, preventing legitimate operations that require reentrancy. In the case of EigenLayer, the OperatorDelegator contract uses the nonReentrant modifier in its receive() function, which blocks ETH withdrawals. This leads to withdrawals being permanently stuck, as the contract prevents the reentrancy required for successfully processing these transactions.

In this tutorial, we will generalize this vulnerability to explain how improper application of the nonReentrant modifier can cause critical functionality to fail, particularly in scenarios involving multi-step operations like asset withdrawals in cross-chain or multi-contract systems such as EigenLayer.

How the Vulnerability Occurs in EigenLayer Withdrawals

  1. Initiating Withdrawals in EigenLayer: In EigenLayer, users can stake assets (including ETH) across multiple strategies. When a user initiates a withdrawal, the OperatorDelegator contract is responsible for processing the queued withdrawals and returning the assets to the user. This process involves multiple steps, and for ETH withdrawals, reentrancy is required to complete the transaction flow between different contracts (e.g., the EigenPod and OperatorDelegator).

  2. Blocking Reentrancy in the Receive Function: The receive() function in the OperatorDelegator contract is called during ETH withdrawals. However, because the nonReentrant modifier is applied to this function, it prevents the contract from handling the reentrant call that is needed to complete the ETH withdrawal. This leads to the withdrawal transaction being permanently stuck.

  3. Permanent Stuck Withdrawals: Since ETH withdrawals rely on a reentrant call to complete the process, the nonReentrant modifier effectively blocks the withdrawal of any ETH from EigenLayer. As a result, users cannot withdraw their ETH, and the assets remain stuck in the contract indefinitely.

Last updated