This repository has been archived by the owner on Oct 20, 2024. It is now read-only.
nilay27 - OptimismRewardCollector::getExpectedExchange() is missing max/min price check for ChainlinkOracle's latestRoundData #163
Labels
Excluded
Excluded by the judge without consulting the protocol or the senior
Non-Reward
This issue will not receive a payout
nilay27
medium
OptimismRewardCollector::getExpectedExchange() is missing max/min price check for ChainlinkOracle's latestRoundData
Summary
getExpectedExchange
uses Chainlink'slatestRoundData
method to fetch the prices foropToUsd
andethToUsd
.The issue is that Chainlink aggregators have a built-in circuit breaker, that is, if an asset experiences a huge drop in value (i.e. LUNA crash) the price of the oracle will continue to return the minPrice instead of the actual price of the asset.
Vulnerability Detail
RewardRouter::distributeRewards()
would fetch the wrong amount viaIRewardCollector(rewards[vault].rewardCollectorAddress).getExpectedExchange(vault)
and will callclaimAndDonateRewards()
with wrongminimumAmountOut
, thus causing significant loss in getting thedebtToken
via exchange.Something similar happened to Venus on BSC when LUNA imploded.
Impact
In the event that an asset crashes (i.e. LUNA), the oracle prices will give false values leading to wrong amount/failure to exchange of DebtToken, leading to breaking of functionality of
distributeRewards
inRewardRouter
andclaimAndDonateRewards
inOptimismRewardCollector
Code Snippet
https://github.com/sherlock-audit/2024-04-alchemix/blob/main/v2-foundry/src/utils/collectors/OptimismRewardCollector.sol#L97-L130
Tool used
Manual Review
Recommendation
Some check like this can be added to avoid returning of the min price or the max price in case of the price crashes to o that when the price edges close to minAnswer or maxAnswer it starts reverting, to avoid consuming stale prices when Chainlink freezes.
The text was updated successfully, but these errors were encountered: