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

Price Oracle could get a stale price

Summary

Not check oracle price accuracy

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();
return (roundId, answer, startedAt, updatedAt, answeredInRound);
}

Vulnerability Details

Stale prices could put funds at risk. According to Chainlink's documentation, This function does not error if no answer has been reached but returns 0, causing an incorrect price fed to the Price Oracle. The external Chainlink oracle, which provides index price information to the system, introduces risk inherent to any dependency on third-party data sources. For example, the oracle could fall behind or otherwise fail to be maintained, resulting in outdated data being fed to the index price calculations. Oracle reliance has historically resulted in crippled on-chain systems, and complications that lead to these outcomes can arise from things as simple as network congestion.

Impact

Oracle prices can be outdated and inaccurate, and oracle prices have update cycles and threshold intervals. You should check the accuracy of the relevant data rather than simply reading the return value.

Tools Used

Visual Studio Code

Recommendations

Check that the timestamp with the return price is within the acceptable threshold.

For example:

(uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) = priceFeed.latestRoundData();
require(answer > 0, "Chainlink price <= 0");
require(answeredInRound >= roundID, "Stale price");
require(updatedAt != 0, "Round not complete");

Support

FAQs

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