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

Chainlink’s latestRoundData might return stale or incorrect results

Summary

Chainlink’s latestRoundData might return stale or incorrect results

Vulnerability Details

On OracleLib.sol, we are using latestRoundData, but there is not enought checks if the return value indicates stale data.

(uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) =
priceFeed.latestRoundData();
uint256 secondsSince = block.timestamp - updatedAt;
if (secondsSince > TIMEOUT) revert OracleLib__StalePrice();

Impact

This can make the price of the token wrong/stale

Tools Used

Manual Review

Recommendations

Add more requirement

require(answeredInRound >= roundID, "Stale price");
require(answer > 0,"Chainlink price <= 0");

Support

FAQs

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