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

skyge - Oracle doesn't check if Arbitrum Sequencer is active #36

Closed
sherlock-admin opened this issue Jul 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

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Jul 1, 2023

skyge

medium

Oracle doesn't check if Arbitrum Sequencer is active

Summary

DODO V3 is going to deployed on mainnet, arbitrum, optimism, bnb chain, polygon, so when using Chainlink in L2 chains such as Arbitrum requires to check if the sequencer is down.

The bug could be leveraged by malicious actors to take advantage of the sequencer downtime.

Vulnerability Detail

There is a lack of a check if the L2 Arbitrum sequencer is down.

function getPrice(address token) public view override returns (uint256) {
    require(priceSources[token].isWhitelisted, "INVALID_TOKEN");
    AggregatorV3Interface priceFeed = AggregatorV3Interface(priceSources[token].oracle);
    (uint80 roundID, int256 price,, uint256 updatedAt, uint80 answeredInRound) = priceFeed.latestRoundData();
    require(price > 0, "Chainlink: Incorrect Price");
    require(block.timestamp - updatedAt < priceSources[token].heartBeat, "Chainlink: Stale Price");
    require(answeredInRound >= roundID, "Chainlink: Stale Price");
    return uint256(price) * 10 ** (36 - priceSources[token].priceDecimal - priceSources[token].tokenDecimal);
}

function getOriginalPrice(address token) public view override returns (uint256, uint8) {
    require(priceSources[token].isWhitelisted, "INVALID_TOKEN");
    AggregatorV3Interface priceFeed = AggregatorV3Interface(priceSources[token].oracle);
    (uint80 roundID, int256 price,, uint256 updatedAt, uint80 answeredInRound) = priceFeed.latestRoundData();
    require(price > 0, "Chainlink: Incorrect Price");
    require(block.timestamp - updatedAt < priceSources[token].heartBeat, "Chainlink: Stale Price");
    require(answeredInRound >= roundID, "Chainlink: Stale Price");
    uint8 priceDecimal = priceSources[token].priceDecimal;
    return (uint256(price), priceDecimal);
}

Impact

could potentially be exploited by malicious actors to gain an unfair advantage.

Code Snippet

Links to same issue in past Sherlock contests being validated as a Medium:

Tool used

Manual Review

Recommendation

It is recommended to follow the code example of Chainlink:
https://docs.chain.link/data-feeds/l2-sequencer-feeds#example-code

Duplicate of #62

@github-actions github-actions bot closed this as completed Jul 5, 2023
@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 Jul 5, 2023
@sherlock-admin2 sherlock-admin2 added the Reward A payout will be made for this issue label Jul 24, 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