sherlock-audit / 2023-05-ironbank-judging

2 stars 2 forks source link

shtesesamoubiq - Chainlink’s latestRoundData might return stale or incorrect results #330

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

shtesesamoubiq

false

Chainlink’s latestRoundData might return stale or incorrect results

Summary

Chainlink’s latestRoundData might return stale or incorrect results

Vulnerability Detail

On PriceOracle.sol , we are using latestRoundData, but there is no check if the return value indicates stale data.

Impact

This could lead to stale prices according to the Chainlink documentation:

https://docs.chain.link/docs/historical-price-data/#historical-rounds https://docs.chain.link/docs/faq/#how-can-i-check-if-the-answer-to-a-round-is-being-carried-over-from-a-previous-round

Code Snippet

image

Tool used

manual Manual Review

Recommendation

add this checks: require(answeredInRound >= roundID, "Stale price");

require(block.timestamp <= updatedAt + stalePriceDelay, Error.STALE_PRICE);