Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chainlink oracles might return stale data #138

Closed
code423n4 opened this issue Jan 30, 2022 · 2 comments
Closed

Chainlink oracles might return stale data #138

code423n4 opened this issue Jan 30, 2022 · 2 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate This issue or pull request already exists

Comments

@code423n4
Copy link
Contributor

Handle

hack3r-0m

Vulnerability details

Location: https://github.com/code-423n4/2022-01-yield/blob/main/contracts/Cvx3CrvOracle.sol#L120-L122

DAI.latestRoundData returns data from the latest round, but there is no guarantee that the latest round happened frequently, it might be a case where latestRoundData has happened 1 hour or 1 day ago.

This can lead to stale data used for calculation and accounting.

Tools Used

Manual Review

Recommended Mitigation Steps

(
    uint80 roundID, 
    int price,
    uint startedAt,
    uint timeStamp,
    uint80 answeredInRound
) = priceFeed.latestRoundData();

check that startedAt and timestamp are within certain permissible bounds (for e.g difference between current timestamp and latest round timestamp is not more than 1 hour)

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Jan 30, 2022
code423n4 added a commit that referenced this issue Jan 30, 2022
@iamsahu iamsahu added the duplicate This issue or pull request already exists label Feb 1, 2022
@alcueca
Copy link
Collaborator

alcueca commented Feb 2, 2022

Duplicate of #94

@alcueca alcueca marked this as a duplicate of #94 Feb 2, 2022
@GalloDaSballo
Copy link
Collaborator

Duplicate of #136

@GalloDaSballo GalloDaSballo marked this as a duplicate of #136 Feb 18, 2022
@GalloDaSballo GalloDaSballo added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

5 participants