sherlock-audit / 2023-05-perennial-judging

12 stars 9 forks source link

GiorgioDalla - Lack of Arbitrum Sequencer Down Check in Key Chainlink Feed Functions #182

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

GiorgioDalla

medium

Lack of Arbitrum Sequencer Down Check in Key Chainlink Feed Functions

Summary

Certain key functions in the Chainlink feed that return price information don't perform a check to confirm if the Arbitrum sequencer is down. This oversight could potentially expose these functions to risks of delivering outdated or incorrect price data, thereby creating potential opportunities for exploitation.

Vulnerability Detail

The following functions that return price data do not incorporate checks to determine if the Arbitrum sequencer is down:

In ChainlinkRegistryLib: -getLatestRound() -getRound() In ChainlinkAggregatorLib: -getLatestRound() -getRound()

This absence of a sequencer status check can lead to issues when interacting with Layer 2 chains like Arbitrum, where the sequencer could be down, yet the price data is falsely perceived as being fresh.

Impact

If exploited, this vulnerability could enable malicious actors to take advantage of these false perceptions of fresh prices. Depending on the nature and scale of the exploitation, this could lead to significant financial implications.

Code Snippet

https://github.com/equilibria-xyz/perennial-mono/blob/b06d5145db62a312dd88dfcafef0f8e2166c5e32/packages/perennial-oracle/contracts/types/ChainlinkAggregator.sol#L32-L36

https://github.com/equilibria-xyz/perennial-mono/blob/b06d5145db62a312dd88dfcafef0f8e2166c5e32/packages/perennial-oracle/contracts/types/ChainlinkAggregator.sol#L44-L48

https://github.com/equilibria-xyz/perennial-mono/blob/b06d5145db62a312dd88dfcafef0f8e2166c5e32/packages/perennial-oracle/contracts/types/ChainlinkRegistry.sol#L34-L38

https://github.com/equilibria-xyz/perennial-mono/blob/b06d5145db62a312dd88dfcafef0f8e2166c5e32/packages/perennial-oracle/contracts/types/ChainlinkRegistry.sol#L48-L52

Tool used

Manual Review Chainlink Docs

Recommendation

To address this vulnerability, it's recommended that these functions incorporate safety checks to confirm the status of the Arbitrum sequencer before processing and returning price data. Implementing this additional layer of validation can help ensure the accuracy of the price data and prevent potential exploits. Here is an example of such implementation : https://docs.chain.link/data-feeds/l2-sequencer-feeds#example-code

Duplicate of #13