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

sl1 - Medim severity - No check for stale price feeds #1

Closed
sherlock-admin opened this issue Jun 11, 2023 · 0 comments
Closed

sl1 - Medim severity - No check for stale price feeds #1

sherlock-admin opened this issue Jun 11, 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

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Jun 11, 2023

sl1

medium

Medim severity - No check for stale price feeds

Summary

getPriceFromChainlink function in PriceOracle.sol does not check for price feed staleness which can lead to wrong price return value.

Vulnerability Detail

Oracle data feed is insufficiently validated. There is no check for stale price. Price can be stale and lead to wrong return value.

Impact

Stale data can lead to wrong price.

Code Snippet

(, int256 price,,,) = registry.latestRoundData(base, quote);
 require(price > 0, "invalid price");

https://github.com/sherlock-audit/2023-05-ironbank/blob/9ebf1702b2163b55479624794ab7999392367d2a/ib-v2/src/protocol/oracle/PriceOracle.sol#L67

Tool used

Manual Review

Recommendation

(, int256 price,, uint256 updatedAt, ) = registry.latestRoundData(base, quote);
        if(updatedAt < block.timestamp - 60 * 60 /* 1 hour */) {
            revert("stale price feed");
        } 
        require(price > 0, "invalid price");

The potential solution is to validate that no more than 1 hour has passed from the "updatedAt" timestamp value returned from "latestRoundData()", otherwise the transaction will revert

Duplicate of #9

@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 Jun 19, 2023
@sherlock-admin sherlock-admin added Non-Reward This issue will not receive a payout and removed Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Jun 25, 2023
@sherlock-admin2 sherlock-admin2 added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Reward A payout will be made for this issue and removed Non-Reward This issue will not receive a payout labels Jul 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

2 participants