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

9 stars 7 forks source link

Sudden increases in TVL can be exploited for profit #320

Closed howlbot-integration[bot] closed 3 months ago

howlbot-integration[bot] commented 4 months ago

Lines of code

https://github.com/code-423n4/2024-04-renzo/blob/main/contracts/RestakeManager.sol#L491

Vulnerability details

The way the protocol is designed allows an attacker to take advantage of a sudden TVL increase. In Renzo a sudden TVL increase might happen for multiple reasons:

An user can exploit this for profit by minting ezETH tokens before the TVL increases, by doing the following:

  1. Deposit an accepted asset to mint ezETH tokens via RestakeManager::deposit()
  2. The TVL of the protocol gets updated and instantly increases, making the attacker ezETH tokens worth more.
  3. Withdraw the ezETH tokens via WithdrawQueue::withdraw().
  4. Wait a delay and complete the withdrawal via WithdrawQueue::claim().

Impact

An attacker can take advantage of a suddent TVL increase to capture extra profit, which leads to fair users earning less than they should.

Proof of Concept

Alice notices there are validator rewards in an EigenPod, and the rewards can be transferred to Renzo:

  1. Alice mints ezETH via RestakeManager::deposit().
  2. Alice calls DelayedWithdrawalRouter::claimDelayedWithdrawals(), which instantly increases the TVL.
  3. Alice ezETH are now valued more, she calls WithdrawQueue::withdraw() to schedule a future withdrawal of her ezETH.
  4. After a delay Alice calls WithdrawQueue::claim() to transfer the ETH/tokens to herself.

1, 2 and 3 can be performed atomically. 4 enforces a delay.

Recommended Mitigation Steps

Sudden TVL increases are unavoidable because at some point rewards have to be added to the TVL, and oracles updates are discrete. Similar systems generally use a deposit queue. Users should deposit their assets (ex. ETH) first, and be able to claim their ezETH after a delay. The amount of ezETH to mint should be calculated at claim time.

Assessed type

Other

jatinj615 commented 3 months ago

Similar to - #420

It is the expected behaviour in the protocol as the rewards come in periodically into the protocol the arbitrage opportunities will be there but when the user withdraws there will be a coolDownPeriod in which they won't be earning any rewards.

C4-Staff commented 3 months ago

CloudEllie marked the issue as primary issue

alcueca commented 3 months ago

The issue exists and is acknowledged by the sponsor. It is debatable how profitable the attack is given the cooldown period, and therefore how large the loss of yield to users.

@jatinj615, note again that a zero cooldown period would make this exploit completely viable.

c4-judge commented 3 months ago

alcueca marked issue #326 as primary and marked this issue as a duplicate of 326

c4-judge commented 3 months ago

alcueca marked the issue as satisfactory