DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: medium
Invalid

LibOracle doesn't check for whether the oracle price has hit the minimum value, which can result in invalid prices

Summary

Chainlink oracles have a circuit breaker where if the price of an asset has a huge drop in value to ~zero, it will instead of returning 0 return a minPrice. The issue is that the current implementation of the oracleCircuitBreaker does not take this into account, meaning that if this happens, LibOracle will start returning invalid prices for that asset.

Vulnerability Details

When using an asset which is not USD, the LibOracle contract will call the oracleCircuitBreaker function, which is defined as follows:

function oracleCircuitBreaker(
uint80 roundId,
uint80 baseRoundId,
int256 chainlinkPrice,
int256 baseChainlinkPrice,
uint256 timeStamp,
uint256 baseTimeStamp
) private view {
bool invalidFetchData = roundId == 0 || timeStamp == 0
|| timeStamp > block.timestamp || chainlinkPrice <= 0 || baseRoundId == 0
|| baseTimeStamp == 0 || baseTimeStamp > block.timestamp
|| baseChainlinkPrice <= 0;
if (invalidFetchData) revert Errors.InvalidPrice();
}

This function fails to check whether the price of the asset has hit its minPrice, which can result in invalid prices being returned.

Impact

Due to not checking for the minPrice of an oracle, LibOracle will return incorrect prices for assets which have crashed in price below minPrice.

Tools Used

Manual review

Recommendations

Consider adding a check for whether the price returned by the oracle is the minPrice for that asset, and if it is, revert.

Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issues

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.