Skip to content
Audit finding Intermediate

getPriceFromChainlink() doesn't check If Arbitrum sequencer is down in Chainlink feeds

The price oracle function reads Chainlink price feeds without checking whether the Arbitrum sequencer is down, so prices could be stale. An attacker could potentially exploit this to gain an unfair advantage.

0x52 Follow with 0xMAKEOUTHILL, Angry_Mustache_Man and 41 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-05-ironbank-judging/issues/440

Found by

0x52, 0xMAKEOUTHILL, Angry_Mustache_Man, Arabadzhiev, Arz, Aymen0909, BenRai, Breeje, Brenzee, BugBusters, Delvir0, HexHackers, Ignite, Jaraxxus, Kodyvim, Madalad, MohammedRizwan, Ocean_Sky, Proxy, R-Nemes, SovaSlava, berlin-101, bin2chen, bitsurfer, branch_indigo, deadrxsezzz, devScrooge, josephdara, kutugu, n1punp, n33k, ni8mare, p0wd3r, plainshift-2, rvierdiiev, santipu_, sashik_eth, shaka, simon135, sl1, toshii, tsvetanovv, turvec, vagrant

Summary

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: getPriceFromChainlink

Solidity
    function getPriceFromChainlink(address base, address quote) internal view returns (uint256) {
@>      (, int256 price,,,) = registry.latestRoundData(base, quote);
        require(price > 0, "invalid price");

        // Extend the decimals to 1e18.
        return uint256(price) * 10 ** (18 - uint256(registry.decimals(base, quote)));
    }

Impact

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

Code Snippet

https://github.com/sherlock-audit/2023-05-ironbank/blob/main/ib-v2/src/protocol/oracle/PriceOracle.sol#L66-L72

Tool used

Manual Review

Recommendation

code example of Chainlink: https://docs.chain.link/data-feeds/l2-sequencer-feeds#example-code

Discussion

0xffff11

Valid medium

ib-tycho

Regarding the mistake in the contest details mentioned in the README, we apologize for any confusion caused. When we stated that we would deploy on Arbitrum and Optimism, we meant that we would make the necessary modifications before deployment. This is our standard practice of maintaining contracts with different branches, same as what we did in v1: https://github.com/ibdotxyz/compound-protocol/branches

We are aware of the absence of a registry on OP and Arb, as pointed out by some individuals. We would like to inquire if it is possible to offer the minimum reward for an oracle issue on L2. Thank you.

ib-tycho

We'll fix this when deploying on L2, but we disagree with Severity. I would consider this as Low

0xffff11

According to past reports and sponsor confirmed that they will fix the issue. The issue will remain as a medium.

MLON33

Assuming this issue is acknowledged by the protocol team and won’t be fixed.

The original report as published on Sherlock, by 0x52. 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.

How it worked

Root cause

Likely the oracle function does not check the Chainlink L2 sequencer uptime feed before using price data.

Impact

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

What the attacker needed

Arbitrum sequencer goes down; Chainlink feed used on L2

The fix

The protocol should add a check for the Chainlink L2 sequencer uptime feed before accepting prices, as shown in Chainlink's example code.

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.

A sequencer is the component that orders transactions on a layer-2 network like Arbitrum. If it goes down, price data from Chainlink can become outdated, but the contract still treats it as current. This could let someone trade on old prices before the system catches up.

More by 0x52

View all

211 more disclosed reports, best first.

More from Iron Bank

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.