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

Chainlink price not checked properly.

Summary

Though the check for stale updatedAt is added, some other necessary checks are not made which may cause serious loss of funds.

Vulnerability Details

The OracleLib library contract is using Chainlink's latestRoundData API, but there is only a check on updatedAt. This could lead to stale prices according to the Chainlink documentation.

Impact

The data obtained from latestRoundData API is used across various functions, therefore, a stale price from Chainlink can lead to loss of funds to end-users.

Tools Used

Manual Review

Recommendations

Consider adding the missing checks for stale data but mainly for answer.

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.