You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2023. It is now read-only.
github-actionsbot opened this issue
Mar 1, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Chainlink's latestRoundData may return stale or incorrect results
Summary
Freshness check should be applied on Chainlink's latestRoundData() function to ensure that the latest answer is recent enough to be used.
Vulnerability Detail
In the current implementation of ChainlinkAdapterOracle.sol's latestRoundData() function, there a lack of proper freshness checks. This could lead to stale prices being used.
For example, if the market price of the token drops rapidly and Chainlink's feed does not get updated in a timely manner, the smart contract will continue to believe the token is worth more than the market value.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
hl_
medium
Chainlink's latestRoundData may return stale or incorrect results
Summary
Freshness check should be applied on Chainlink's latestRoundData() function to ensure that the latest answer is recent enough to be used.
Vulnerability Detail
In the current implementation of ChainlinkAdapterOracle.sol's latestRoundData() function, there a lack of proper freshness checks. This could lead to stale prices being used.
For example, if the market price of the token drops rapidly and Chainlink's feed does not get updated in a timely manner, the smart contract will continue to believe the token is worth more than the market value.
Impact
Stale prices may be used.
Code Snippet
https://github.com/sherlock-audit/2023-02-blueberry/blob/main/contracts/oracle/ChainlinkAdapterOracle.sol#L76-L83
Tool used
Manual Review
Recommendation
Consider adding the missing freshness check for stale price:
require(answer > 0, "Chainlink answer <= 0");
require(answeredInRound >= roundId, "Stale price");
require(updatedAt != 0, "Round not complete");
Duplicate of #94
The text was updated successfully, but these errors were encountered: