Skip to content
Audit finding Intermediate

A design flaw in the case of using 2 oracles (aka PegOracle)

The PegOracle design treats both assets in a pair symmetrically, so a depeg event can be falsely triggered if the underlying asset (e.g., WBTC or USDC) deviates from its canonical value, even when the tracked asset (e.g., renBTC or MIM) remains stable. An attacker could exploit this to cause incorrect depeg events, potentially leading to indirect loss of assets.

PwnPatrol Follow

Originally disclosed on Code4rena

Submitted by PwnPatrol

A design flaw in the case of using 2 oracles (aka PegOracle).

Proof of Concept

Chainlink provides price feeds denominated either in ETH or USD. But some assets don’t have canonical value accessed on-chain. An example would be BTC and it’s many on-chain forms like renBTC, hitBTC, WBTC, aBTC etc… For example in the case of a market on renBTC depegging from BTC value, probably a pair like renBTC/WBTC would be used (leveraging PegOracle). But even if renBTC perfectly maintains it’s value to BTC, the depeg event can be triggered when WBTC significantly depreciates or appreciates against BTC value. This depeg event will be theoretically unsound since renBTC behaved as expected. The flaw comes from PegOracle because it treats both assets symmetrically.

This is also true for ETH pairs like stETH/aETH etc.. or stablecoin pairs like FRAX/MIM etc.. Of course, it should never be used like this because Chainlink provides price feeds with respect to true ETH and USD values but we have found that test files include PegOracle for stablecoin pairs.

Recommended Mitigation Steps

Support markets only for assets that have access to an oracle with price against canonical value x/ETH or x/USD.

MiguelBits (Y2K Finance) disputed

HickupHH3 (judge) commented:

From what I understand, the warden is arguing that if the underlying asset is itself a pegged asset, then it wouldn’t be a very good measure against the “canonical price”.

Eg. MIM (pegged) -> USDC (underlying), and USDC de-pegs, even though MIM is close to $1, the protocol would recognise this as a de-peg event.

I agree with the issue, but disagree with the severity. The choice of the underlying token is quite obviously important; I think the sponsor can attest to this.

@3xHarry thoughts? Perhaps low severity is more appropriate because it isn’t a technical vulnerability per-se, more of the choice of underlying to be used.

HickupHH3 (judge) commented:

Keeping high severity even though there are a couple of prerequisites:

  • the protocol uses a poor underlying token (Eg. USDT that has de-pegged to $0.97 before)
  • underlying token de-pegs substantially to inaccurately trigger (or not trigger) a de-peg event

I classify this as indirect loss of assets from a valid attack path that does not have hand-wavy hypotheticals

3 — High: Assets can be stolen/lost/compromised directly (or indirectly if there is a valid attack path that does not have hand-wavy hypotheticals).


The original report as published on Code4rena, by PwnPatrol. 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

Impact

This could lead to indirect loss of assets because a depeg event may be triggered inaccurately when the underlying token depegs, even if the tracked asset remains stable.

What the attacker needed

Protocol uses a poor underlying token; underlying token de-pegs substantially

The fix

The protocol should only support markets for assets that have an oracle providing a price against a canonical value (x/ETH or x/USD).

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.

This report is about a design flaw in a price oracle that compares two assets. If one asset is supposed to be pegged to another (like a stablecoin to USD), the oracle assumes both are equally reliable. But if the underlying asset loses its peg, the oracle wrongly thinks the tracked asset has depegged, which could cause financial losses.

More by PwnPatrol

View all

4 more disclosed reports, best first.

More from Y2k Finance contest

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.