Skip to content
Audit finding Intermediate

ChainlinkAdapterOracle use BTC/USD chainlink oracle to price WBTC which is problematic if WBTC depegs

The protocol prices WBTC using the Chainlink BTC/USD oracle, assuming WBTC always equals BTC. If the WBTC bridge is compromised and WBTC depegs, the protocol would continue to lend against an effectively worthless asset, accumulating bad debt.

0x52 Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-02-blueberry-judging/issues/9

Found by

0x52

Summary

The chainlink BTC/USD oracle is used to price WBTC (docs). WBTC is basically a bridged asset and if the bridge is compromised/fails then WBTC will depeg and will no longer be equivalent to BTC. This will lead to large amounts of borrowing against an asset that is now effectively worthless. Since the protocol still values it via BTC/USD the protocol will not only be stuck with the bad debt caused by the currently outstanding loans but they will also continue to give out bad loans and increase the amount of bad debt further

Vulnerability Detail

See summary.

Impact

Protocol will take on a large amount of bad debt should WBTC bridge become compromised and WBTC depegs

Code Snippet

https://github.com/sherlock-audit/2023-02-blueberry/blob/main/contracts/oracle/ChainlinkAdapterOracle.sol#L47-L59

Tool used

Manual Review

Recommendation

I would recommend using a double oracle setup. Use both the Chainlink and another on-chain liquidity base oracle (i.e. UniV3 TWAP). If the price of the on-chain liquidity oracle drops below a certain threshold of the Chainlink oracles (i.e. 2% lower), any borrowing should be immediately halted. The chainlink oracle will prevent price manipulation and the liquidity oracle will safeguard against the asset depegging.

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 design relies solely on the BTC/USD Chainlink feed for WBTC without any check on WBTC's actual market price or liquidity, so a depeg would not be detected.

Impact

The protocol could take on a large amount of bad debt if the WBTC bridge is compromised and WBTC depegs.

What the attacker needed

WBTC bridge compromised or fails; WBTC depegs from BTC

The fix

The protocol should use a double oracle setup combining Chainlink with an on-chain liquidity-based oracle (e.g., UniV3 TWAP) and halt borrowing if the liquidity oracle price drops significantly below Chainlink.

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.

WBTC is a token that represents Bitcoin on another blockchain, backed by a bridge that holds real Bitcoin. The protocol assumes WBTC is always worth the same as Bitcoin, so it uses the Bitcoin price to value WBTC. If the bridge fails, WBTC could become worthless, but the protocol would still treat it as valuable and keep lending money against it, losing funds.

More by 0x52

View all

211 more disclosed reports, best first.

More from Blueberry Update #3

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.