29738 - [SC - Low] Missing Chainlink circuit breaker check allows ...
Submitted on Apr 1st 2024 at 06:09:20 UTC by @marchev for Boost | Immunefi Arbitration
Report ID: #29738
Report type: Smart Contract
Report severity: Low
Target: https://github.com/immunefi-team/vaults/blob/main/src/RewardTimelock.sol
Impacts:
Theft of unclaimed royalties
Description
Brief/Intro
Chainlink aggregators feature a built-in circuit breaker that activates during significant price fluctuations, keeping the asset price within a pre-defined range. In scenarios like the LUNA crash, the oracle reports a pre-set minimum value (minAnswer) rather than the real market price. This mechanism could enable malicious projects to payout rewards that are below market value by leveraging the inflated price from the Chainlink oracle.
Such a vulnerability has resulted in a $11M exploit on Venus Protocol during the LUNA crash: https://therecord.media/collapse-of-luna-cryptocurrency-leads-to-11-million-exploit-on-venus-protocol
Vulnerability Details
The RewardTimelock contract depends on Chainlink price oracles to align reward payouts with the actual market value. It employs _checkRewardDollarValue, a function that fetches the asset's current market price with PriceConsumer#tryGetSaneUsdPrice18Decimals(), implementing various checks to ensure the price's accuracy and relevance.
Nonetheless, this function lacks verification for the activation of Chainlink's circuit breaker. In extreme price movements, when the asset price falls below minAnswer or rises above maxAnswer, the Chainlink feed still reports these thresholds instead of the actual market price of the asset. Missing this critical check means a project could exploit the situation and pay whitehats a reduced award under these circumstances.
Let's take the following example:
Example scenario:
A significant price drop triggers the Chainlink circuit breaker for a reward token, causing the feed to report
minAnswer.A project initiates a whitehat reward payout via
RewardTimelock.After the cooldown period, the project executes the payout at the reported, inflated price.
Impact Details
This vulnerability means a whitehat could receive a reward less valuable than the market-equivalent dollar amount expected. While such an exploit relies on rare, dramatic market events (akin to the LUNA crash), the potential impact is significant, allowing projects to issue substantially undervalued rewards. Thus, this vulnerability is classified with Low severity to reflect its low likeliehood.
Solution
The proposed fix involves integrating checks for the activation of Chainlink's circuit breaker. The following code modifications illustrate the necessary adjustments:
Furthermore, a new interface, src/oracles/IOffchainAggregatorMinimal.sol, is required to fetch the minAnswer and maxAnswer directly from the aggregator:
Proof of Concept
The following coded PoC demonstrates how a payout could be performed even if the Chainlink price oracle's circuit breaker is activated.
Add the following import in test/foundry/RewardTimelock.t.sol:
Then add the following test case to it as well:
Run the PoC via forge test --mt "testNoCircuitBreakerForMinMaxPriceWhenExecutingRewardTx" -vvvvv
The expected behavior is that the reward payout fails but the actual behavior is that it gets executed successfully.
Last updated
Was this helpful?