Closed c4-bot-5 closed 6 months ago
Invalid.
From the sponsor comment on Discord:
- The revert condition in RenzoOracleL2
if (_scaledPrice < 1 ether) revert InvalidOraclePrice();
As, ezETH is a yieldBearing Token which means exchangeRate of ezETH >= 1 ETH. The revert condition is placed to provide a protection of protocol collateral against any wrong oracle feed and restricts user to deposit and mint more ezETH then they are supposed to.
@howlbot reject
Lines of code
https://github.com/code-423n4/2024-04-renzo/blob/519e518f2d8dec9acf6482b84a181e403070d22d/contracts/Bridge/L2/Oracle/RenzoOracleL2.sol#L55 https://github.com/code-423n4/2024-04-renzo/blob/519e518f2d8dec9acf6482b84a181e403070d22d/contracts/Bridge/L2/xRenzoDeposit.sol#L245 https://github.com/code-423n4/2024-04-renzo/blob/519e518f2d8dec9acf6482b84a181e403070d22d/contracts/Bridge/L2/xRenzoDeposit.sol#L293
Vulnerability details
Impact
All subsequent _deposit() function calls reverts. Even can't use the
lastPrice
,lastPriceTimestamp
as per current implementations.Proof of Concept
Possible situations oracle price down
POC
_deposit() function initiates a call to the getMintRate() function to fetch the current price of ezETH.
Inside getMintRate(), the function checks if the oracle address is set and then calls the external oracle’s
getMintRate()
to obtain the latest price data.The price fetched from the oracle is scaled to have 18 decimals.
The getMintRate() function checks if the scaled price is below 1 ETH (_scaledPrice < 1 ether) so this function reverts.
Due to the reversion, any ongoing transactions or operations relying on this function for price data are immediately stopped.
If the oracle continues to report
ezETH
prices below 1 ETH, the smart contract operations requiring price data remain inoperative.This creates a potential Denial of Service (DoS) all subsequent _deposit() calls become
DOS
. Yes its possible to accesslastPrice
,lastPriceTimestamp
for alternative but this is only possible situations where,oracleTimestamp < lastPriceTimestamp
If oracle is set always price fetched from oracle itself.
Tools Used
Manual Audit
Recommended Mitigation Steps
Change the code to following way.This will solve the issue
Assessed type
Oracle