Skip to content
Business logic Audit finding Advanced

upgradeProtocol can create Peg Risk via Oracle Price Arbitrage

The upgradeProtocol function allows a new protocol version to share the same LUSD token while using a different oracle, which can create price discrepancies between the old and new systems. An attacker could exploit these differences through redemption arbitrage, potentially extracting value and increasing peg risk.

GalloDaSballo Follow

Originally disclosed on Code4rena

Submitted by GalloDaSballo

upgradeProtocol is meant to enable a new version of the protocol while retaining the same LUSD token.

https://github.com/code-423n4/2023-02-ethos/blob/73687f32b934c9d697b97745356cdf8a1f264955/Ethos-Core/contracts/LUSDToken.sol#L160-L181

    function upgradeProtocol(

In case of a migration, with the same collateral, but a new oracle, the system could open up to arbitrage between the two oracles via redemptions, allowing to extract value from the difference between the 2 prices.

This is because each oracle (e.g. chainlink), can change it’s price based on two aspects:

  • Hearbeat -> Maximum amount of time before the feed is updated
  • Threshold -> % change at which the price is changed no matter what

In case of the oracle being different, for example having a different heartbeat setting, or simply having a different cadence (e.g. one refreshes at noon the other at 3 pm), the difference can open up to Arbitrage Strategies that can potentially increase risk to the system.

Arbitrage through Redemptions Explanation

The fact that that older version of the protocol can burn means they could allow for redemption arbitrage, leaking value.

https://github.com/code-423n4/2023-02-ethos/blob/73687f32b934c9d697b97745356cdf8a1f264955/Ethos-Core/contracts/LUSDToken.sol#L366-L367

        // old versions of the protocol may still burn

Burning of tokens can be performed via two operations:

  • Repayment
  • Redemptions

Repayment seems to be safest options and it’s hard to imagine a scenario for exploit.

If the oracle offers a different price for redemptions, that can crate an incentive to go redeem against the older system, and since the older system cannot create new Troves, the CR for it could suffer.

The way in which this get’s problematic is if there’s positions that risk becoming under-collateralized in the old system and the debt from those positions is used to redeem against better collateralized positions on the new migrated system

This would create an economic incentive to leave the bad debt in older system as the new one is offering a more profitable opportunity.

Additional Resources

An example of desynch is what happened to a Gearbox Ninja, that got liquidated due to hearbeat differences

https://twitter.com/gearbox_intern/status/1587957233605918721

Remediation Steps

It will be best to ensure that a collateral is either in the old system, or on the new system, and if the same collateral is in both version, I believe the Oracle must be the same as to avoid inconsistent pricing.

It may also be best to change the migration pattern to one based on Zaps, which will offer good UX but reduce risk to the LUSD peg dynamic.

Trust (judge) commented:

Warden did well to state all the hypotheticals, however imo the requirement that the two oracles must be different for this opportunity to arise is too theoretical for medium severity. Will leave for sponsor review.

tess3rac7 (Ethos Reserve) disputed and commented:

however imo the requirement that the two oracles must different for this opportunity to arise is too theoretical for med severity. Will leave for sponsor review.

Agree. Warden also overlooked redemption fee, which could be a very large % depending on the ratio of redeemedAmount :: total outstanding debt of market in old protocol. No one would arb if money is lost on each redemption.

Seems more just like an informational warning to use the same oracles if we ever upgrade rather than a bug report.


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

Likely the upgrade mechanism permits the new protocol version to use a different oracle while sharing the same token, enabling price discrepancies that can be exploited via redemptions.

Impact

Could allow arbitrageurs to extract value from price differences, potentially increasing peg risk and leaving bad debt in the old system.

What the attacker needed

Protocol upgrade with different oracle; same collateral in both systems; redemption enabled in old system

The fix

The oracle should be the same for the same collateral across both systems, or the migration pattern should be changed to one based on Zaps to reduce risk.

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.

When a system is upgraded, it might use a new price feed (oracle) that updates at different times than the old one. If both old and new systems share the same token, someone could buy low where the price is stale and sell high where it's fresh, making a profit at the system's expense. This is like arbitrage, but it can weaken the token's stability.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by GalloDaSballo

View all

30 more disclosed reports, best first.

More from Ethos Reserve contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.