Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

martin - Chainlink’s latestRoundData might return stale results #307

Closed
sherlock-admin opened this issue Mar 27, 2023 · 0 comments
Closed
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Mar 27, 2023

martin

medium

Chainlink’s latestRoundData might return stale results

Summary

Chainlink’s latestRoundData might return stale results

Vulnerability Detail

Chainlink’s latestRoundData might return stale results

Impact

Across these contracts, you are using Chainlink’s latestRoundData API, but there is no check on updatedAt property. Not checking how stale the answer is could lead to stale prices according to the Chainlink documentation and even to entirely drained protocols.

Code Snippet

299: (uint80 roundID, int256 price, , , uint80 answeredInRound) = priceFeed

https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Controllers/ControllerPeggedAssetV2.sol#L299

Tool used

Manual Review

Recommendation

Consider adding the missing checks for stale data:

(uint80 roundID, int256 price, , uint256 updatedAt, uint80 answeredInRound) = priceFeed.latestRoundData();
require(block.timestamp -  updatedAt <= MAX_ORACLE_FRESHNESS_SECONDS>, "Last price update was too long ago.");

Duplicate of #70

@github-actions github-actions bot closed this as completed Apr 3, 2023
@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Apr 3, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant