Skip to content
DoS Audit finding Intermediate

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.

TomFrenchBlockchain Follow

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.

https://github.com/code-423n4/2021-11-vader/blob/3a43059e33d549f03b021d6b417b7eeba66cf62e/contracts/twap/TwapOracle.sol#L143-L146

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.

alcueca (judge) commented:

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.

SamSteinGG (Vader) commented:

The TWAP oracle module has been completely removed and redesigned from scratch as LBTwap that is subject of the new audit.

The original report as published on Code4rena, by TomFrenchBlockchain. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by TomFrenchBlockchain

View all

28 more disclosed reports, best first.

More from Vader Protocol contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.