Should a Chainlink aggregator become stuck in a stale state then TwapOracle will become irrecoverably broken
The TwapOracle contract relies on a Chainlink aggregator and has no way to update its address. If the aggregator becomes stuck in a state where its price check fails, the consult function will always revert, making the oracle irrecoverably broken.
Originally disclosed on Code4rena
Submitted by TomFrenchBlockchain
Impact
Inability to call consult on the TwapOracle and so calculate the exchange rate between USDV and VADER.
Proof of Concept
Should any of the Chainlink aggregators used by the TwapOracle becomes stuck in such a state that the check on L143-146 of TwapOracle.sol consistently fails (through a botched upgrade, etc.) then the consult function will always revert.
There is no method to update the address of the aggregator to use so the TwapOracle will be irrecoverable.
Recommended Mitigation Steps
Allow governance to update the aggregator for a pair (ideally with a timelock.)
SamSteinGG (Vader) diagreed with severity:
The scenario of a Chainlink oracle ceasing function is very unlikely and would cause widespread issues in the DeFi space as a whole.
I’m going to maintain the severity 2 rating despite the low probability of a Chainlink aggregator being permanently disabled. The risk exists, and in general third-party dependencies should be treated with respect in code and documentation.
The TWAP oracle module has been completely removed and redesigned from scratch as LBTwap that is subject of the new audit.
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
The TwapOracle contract hardcodes the Chainlink aggregator address and provides no mechanism to update it, so any permanent failure of the aggregator cannot be recovered from.
Impact
If a Chainlink aggregator becomes stuck, the TwapOracle's consult function will always revert, preventing exchange rate calculations between USDV and VADER; the report notes this scenario is very unlikely.
What the attacker needed
Chainlink aggregator becomes stuck
The fix
The TwapOracle module was completely removed and redesigned from scratch as LBTwap, which is subject to a new audit.
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 smart contract called TwapOracle uses an external price feed from Chainlink to calculate exchange rates. If that price feed stops working correctly, the oracle's function that calculates rates will always fail, and there is no way to point it to a new price feed. This means the oracle becomes permanently unusable.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.