Pending withdrawals prevent safe removal of collateral assets
The RestakeManager contract allows an admin to remove a collateral token even when pending withdrawals for that token remain in the WithdrawQueue. This causes the token's balance to be excluded from total TVL while ezETH supply is unchanged, inflating mint and redeem rates.
LessDupes Follow with kennedy1030, ZanyBonzy and 10 others
Originally disclosed on Code4rena
Submitted by LessDupes, also found by kennedy1030, Bauchibred (1, 2), ZanyBonzy, inzinko, KupiaSec, OMEN, t0x1c, TECHFUND, 14si2o_Flint, Hajime (1, 2), oxwhite (1, 2, 3, 4), golu, Bigsam, CodeWasp, and 0xAadi
https://github.com/code-423n4/2024-04-renzo/blob/main/contracts/RestakeManager.sol#L316-L321
https://github.com/code-423n4/2024-04-renzo/blob/main/contracts/Withdraw/WithdrawQueue.sol#L279
Vulnerability details
The RestakeManager contract allows the admin to add and remove collateral tokens that are accepted for deposits into the protocol via the addCollateralToken() and removeCollateralToken() functions.
From the protocol team:
(In order to) remove a collateral token we can withdraw full and increase the withdraw buffer to let users withdraw it.
However, since users cannot be forced to claim their withdrawals, it is always possible that a significant amount of the collateral token remains in the WithdrawQueue indefinitely in outstanding withdrawals.
In that case, calling removeCollateralToken() for that token would break accounting in the protocol. The ezETH total supply would still reflect the amounts that were burned to initiate those withdrawals, but the token balance in the WithdrawQueue would no longer be counted towards the TVL.
Impact
The RestakeManager admin is unable to safely remove a collateral token. Removing the token anyway would inflate the ezETH mint and redeem rate compared to the actual backing collateral value.
Proof of Concept
Assume token1 has a balance of Y in the WithdrawQueue from pending user withdrawals. If removeCollateralToken(token1) is called:
token1is removed from thecollateralTokensarray.token1balance ofYis still inWithdrawQueuebut no longer counted intotalTVL.- Mint rate for
ezETHincreases sincetotalTVLis lower butezETHtotal supply is unchanged. - Redeem rate for
ezETHalso increases sinceezETHis now redeemable for a larger share of the remaining collateral.
The mint and redeem rates for ezETH are now inflated compared to the true value of the collateral backing it, since Y worth of token1 is not accounted for in totalTVL but is still effectively backing the ezETH that was burned to withdraw it.
Recommended Mitigation Steps
Consider forcing pending withdrawals of a token to be claimed before that token can be removed as collateral. This could be done by only allowing removeCollateralToken() to be called if claimReserve[token] == 0.
Alternatively, include the balance of the WithdrawQueue in the TVL calculation even for tokens that have been removed, as long as there are still pending withdrawals of that token. This would ensure mint and redeem rates remain correct.
jatinj615 (Renzo) acknowledged and commented:
Will be partially mitigating this by having a sanity check on
removeCollateralTokento revert ifwithdrawQueueBalance is non zero for the collateral asset getting removed.The force
kickOffwill be implemented later on.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the removeCollateralToken function does not check for pending withdrawals (claimReserve) or include the WithdrawQueue balance in TVL for removed tokens.
Impact
The admin cannot safely remove a collateral token; doing so would inflate the ezETH mint and redeem rates compared to the actual backing collateral value.
What the attacker needed
Admin calls removeCollateralToken; pending withdrawals exist for that token
The fix
The team will partially mitigate by adding a sanity check to removeCollateralToken that reverts if the WithdrawQueue balance for the collateral asset is non-zero, with a force kickOff to be implemented later.
How it was found
- Assume token1 has a balance of Y in the WithdrawQueue from pending user withdrawals.
- Call removeCollateralToken(token1).
- token1 is removed from the collateralTokens array.
- token1 balance of Y is still in WithdrawQueue but no longer counted in totalTVL.
- Mint rate for ezETH increases since totalTVL is lower but ezETH total supply is unchanged.
- Redeem rate for ezETH also increases since ezETH is now redeemable for a larger share of the remaining collateral.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In this protocol, users can deposit collateral tokens to get ezETH tokens, and later burn ezETH to request withdrawals. If the admin removes a collateral token while some users still have pending withdrawals in that token, the token's balance is no longer counted in the total value locked (TVL). This makes each remaining ezETH appear more valuable than it really is, which can distort minting and redeeming.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.