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

csanuragjain - Improper Validation Of latestRoundData Function #63

Closed
github-actions bot opened this issue Mar 1, 2023 · 0 comments
Closed

csanuragjain - Improper Validation Of latestRoundData Function #63

github-actions bot opened this issue Mar 1, 2023 · 0 comments
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

csanuragjain

medium

Improper Validation Of latestRoundData Function

Summary

Additional checks on latestRoundData is missing. This means even a stale price is accepted and returned to user

Vulnerability Detail

Necessary checks are missing while using latestRoundData function which means the returned price might be stale

Impact

Price returned could be stale

Code Snippet

https://github.com/sherlock-audit/2023-02-blueberry/blob/main/contracts/oracle/ChainlinkAdapterOracle.sol#L76-L83

Tool used

Manual Review

Recommendation

Change the implementation as below :

        (uint80 latestRoundId, int answer,,uint256 updatedAt,uint80 answeredInRound) =
           registry.latestRoundData(
            token,
            USD
        );

      require (answer >= 0, "Negative price");
      require(answeredInRound >= latestRoundId,"Price Stale" );
        ...

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