code-423n4 / 2024-04-renzo-validation

1 stars 1 forks source link

Potential withdraw credentials overwritting by a malicious node operator #868

Closed c4-bot-7 closed 1 month ago

c4-bot-7 commented 1 month ago

Lines of code

https://github.com/code-423n4/2024-04-renzo/blob/519e518f2d8dec9acf6482b84a181e403070d22d/contracts/Delegation/OperatorDelegator.sol#L355

Vulnerability details

Impact

While performing a stake into the EigenLayer OperatorDelegator.sol#L355, the Ether could be stolen.

Proof of Concept

The specification of ETH2.0 staking allows for two types of deposits: the initial deposit and the top-up deposit, which increases the balance of a previously made initial deposit. Unfortunately, the current implementation of the mainnet deposit contract does not sufficiently distinguish between these types of deposits. This oversight allows an attacker to front-run a Renzo's deposit with their own initial deposit causing Renzo's deposit to be treated as a top-up of the attacker's deposit. Consequently, Renzo's withdrawal credentials will be ignored, and the assets will be accounted for on behalf of the attacker.

When ETH is deposited and ready to be staked, OperatorDelegator:stakeETH() is called which in turns calls eigenPodManager.stake{value: ETH_DEPOSIT_SIZE}(publicKey, signature, depositDataRoot) The withdrawal credentials point to the OperatorDelegator's Eigenpod.

A malicious operator may however front-run this transaction, by depositing 1 ETH into the Beacon chain deposit contract with the same validator keys but with a different, operator-controlled withdrawal credentials. Renzo's OperatorDelegator's transaction would be successfully processed but the withdrawal credentials provided by the operator will not be overwritten.

The end state is a validator managing 1 ETH of node operator’s funds and 32 ETH of Renzo users’ funds, fully controlled and withdrawable by the OperatorDelagator.

This issue has been classified as high severity due to the potential for permanent loss of project liquidity.

Tools Used

Manual Review

Recommended Mitigation Steps

Make an initial deposit, ideally with 1 ETH from operators and verify the withdrawal credentials before staking user's ETH / Acknowledge operator trust and handle this via some other punishment mechanism for the operator

Assessed type

Oracle

raymondfam commented 1 month ago

@howlbot reject

raymondfam commented 1 month ago

See #8.