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

hl_ - Chainlink's latestRoundData may return stale or incorrect results #208

Closed
github-actions bot opened this issue Mar 1, 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

@github-actions
Copy link

github-actions bot commented Mar 1, 2023

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

@github-actions github-actions bot added Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue labels Mar 1, 2023
@github-actions github-actions bot closed this as completed Mar 1, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Mar 19, 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