The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: medium
Invalid

Lack of Stale Data Check for latestRoundData calls

Summary

The contract exhibits a severe vulnerability as it uses the latestRoundData function without checking for stale data. The absence of this check could result in the retrieval of outdated or incorrect prices, as highlighted in the Chainlink documentation.

Vulnerability Details

The root cause of the vulnerability is the omission of a check for stale data in the usage of latestRoundData. This oversight may lead to the acceptance of outdated prices, compromising the accuracy of the retrieved data.

Impact

Without the implementation of a stale data check, the contract risks using obsolete prices from the latestRoundData function. This could have significant consequences, especially in financial applications where up-to-date and accurate pricing data is crucial.

Tools Used

Manual Review

Recommendations

It is imperative to enhance the security of the contract by implementing a thorough check for stale data when using the latestRoundData function. The provided recommendation code snippet can serve as a starting point, ensuring that only current and valid price data is utilized.

Example:

+ (uint80 roundID, int256 answer, uint256 timestamp, uint256 updatedAt, ) = latestRoundData(
+ token,
+ USD
+ );
+ // Solution
+ require(updatedAt >= roundID, "Stale price");
+ require(timestamp != 0,"Round not complete");
+ require(answer > 0,"Chainlink answer reporting 0");
+
+ if (updatedAt < block.timestamp - maxDelayTime)
+ revert PRICE_OUTDATED(_token);
+
+ return (answer.toUint256() * 1e18) / 10**decimals;
Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Chainlink-price

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

Chainlink-price

Support

FAQs

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