15,000 USDC
View results
Submission Details
Severity: medium
Valid

min/max chainlink price oracle issue

Vulnerability Details

When fetching a price from a Chainlink price feed, a range of data is retrieved to ensure data accuracy, data validity, and user data security. Several checks, such as timeouts, have been implemented in the protocol. However, the oracleLib module lacks a verification step to ensure that the fetched price falls within the acceptable minimum and maximum values.d max value.

Impact

If an incorrect price is returned, it may cause DSC to be exchanged at a higher or lower value than the actual price of the collateral.

Tools Used

Manual Review

Recommendation

function staleCheckLatestRoundData(AggregatorV3Interface priceFeed)
public
view
returns (uint80, int256, uint256, uint256, uint80)
{
(uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) =
priceFeed.latestRoundData();
uint256 secondsSince = block.timestamp - updatedAt;
if (secondsSince > TIMEOUT) revert OracleLib__StalePrice();
require(answer >= min_price && answer <= max_price) //create a min_price and max_price.
return (roundId, answer, startedAt, updatedAt, answeredInRound);
}

Support

FAQs

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