_validateAndGetPrice() doesn't check If Arbitrum sequencer is down in Chainlink feeds
The price oracle contract on Arbitrum did not check whether the L2 sequencer was down before accepting Chainlink price feed data. An attacker could exploit a sequencer outage to use stale prices for unfair advantage.
When utilizing Chainlink in L2 chains like Arbitrum, it's important to ensure that the prices provided are not falsely perceived as fresh, even when the sequencer is down. This vulnerability could potentially be exploited by malicious actors to gain an unfair advantage.
Vulnerability Detail
There is no check:
SOLDITY
solidity function _validateAndGetPrice(AggregatorV2V3Interface feed_, uint48 updateThreshold_)
internal
view
returns (uint256)
{
// Get latest round data from feed
(uint80 roundId, int256 priceInt, , uint256 updatedAt, uint80 answeredInRound) = feed_
.latestRoundData();
// @audit check if Arbitrum L2 sequencer is down in Chainlink feeds: medium
// Validate chainlink price feed data
// 1. Answer should be greater than zero
// 2. Updated at timestamp should be within the update threshold
// 3. Answered in round ID should be the same as the round ID
if (
priceInt <= 0 ||
updatedAt < block.timestamp - uint256(updateThreshold_) ||
answeredInRound != roundId
) revert BondOracle_BadFeed(address(feed_));
return uint256(priceInt);
}
Impact
could potentially be exploited by malicious actors to gain an unfair advantage.
Agree this should be fixed for using the Chainlink Oracle Contract on L2s. I think the best way to handle is to have a mainnet version of the contract (as is) and L2 version of the contract which implements the sequencer feed check.
UsmannK
Escalate for 10 USDC.
Watson states that the arbitrum sequencer may temporarily go down and cause stale prices to be read from the oracle. This is incorrect; the arbitrum sequencer going down cannot result in stale prices to be accepted.
// Validate chainlink price feed data
// 1. Answer should be greater than zero
// 2. Updated at timestamp should be within the update threshold
// 3. Answered in round ID should be the same as the round ID
if (
priceInt <= 0 ||
updatedAt < block.timestamp - uint256(updateThreshold_) ||
answeredInRound != roundId
) revert BondOracle_BadFeed(address(feed_));
Watson states that the arbitrum sequencer may temporarily go down and cause stale prices to be read from the oracle. This is incorrect; the arbitrum sequencer going down cannot result in stale prices to be accepted.
// Validate chainlink price feed data
// 1. Answer should be greater than zero
// 2. Updated at timestamp should be within the update threshold
// 3. Answered in round ID should be the same as the round ID
if (
priceInt <= 0 ||
updatedAt < block.timestamp - uint256(updateThreshold_) ||
answeredInRound != roundId
) revert BondOracle_BadFeed(address(feed_));
Updating the escalation resolution.
Considering this issue as a valid medium, additional sponsor comments:
If it updates again within the update threshold. The feeds typically can update several times within a threshold period if the price is moving a lot
when the sequencer is down, the new price won't be reported to the chain. the feed on the L2 will return the value it had when it went down
sherlock-admin
Escalation rejected
Updating the escalation resolution.
Considering this issue as a valid medium, additional sponsor comments:
If it updates again within the update threshold. The feeds typically can update several times within a threshold period if the price is moving a lot
when the sequencer is down, the new price won't be reported to the chain. the feed on the L2 will return the value it had when it went down
This issue's escalations have been rejected!
Watsons who escalated this issue will have their escalation amount deducted from their next payout.
The original report as published on Sherlock, by Avci. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about a minute. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
Likely the contract's price validation function did not check the status of the Arbitrum sequencer before accepting Chainlink price data.
Impact
could potentially be exploited by malicious actors to gain an unfair advantage.
What the attacker needed
Arbitrum sequencer goes down
The fix
The issue was fixed by adding a check for the Arbitrum sequencer status, as shown in the linked pull request.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about a minute. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
This report is about a smart contract that reads prices from an external service called Chainlink. On some blockchains like Arbitrum, a central computer called a sequencer can go offline, and during that time price updates stop. The contract did not check for this, so it might use old prices, which could be abused.