Skip to content
Business logic Audit finding Intermediate

Using the collateral assets' oracle price at 100% of its value to mint USSD without a fee can be used for arbitrage

The protocol allowed minting of USSD stablecoin using collateral at the full oracle price without any fee. An attacker could exploit the difference between the oracle price and the market price to mint USSD and sell it for a profit, potentially draining value from the protocol.

WatchPug Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-05-USSD-judging/issues/836

Found by

WATCHPUG

Summary

Allowing the users to mint USSD using the collateral assets, at 100% of its value based on the oracle price without a fee can easily be exploited by the arbitragers.

Vulnerability Detail

The Oracle price can not be trusted as the real-time price.

For example, the BTC/USD and ETH/USD price feeds on miannet have a "Deviation threshold" of 0.5%, meaning that the price will only be updated once the price movement exceeds 0.5% within the heartbeat period.

Say if the previous price point for WETH is 1000 USD, the price will only be updated once the price goes up to more than 1005 USD or down to less than 995 USD.

Impact

When the market price of WETH is lower than the oracle price, it is possible to mint 1000 USSD by using 1 WETH and selling it to DAI, causing the quality of the collateral for USSD to continuously decrease and the value to be leaked to the arbitragers.

Code Snippet

https://github.com/sherlock-audit/2023-05-USSD/blob/main/ussd-contracts/contracts/USSD.sol#L150-L173

Tool used

Manual Review

Recommendation

Consider adding a minting fee of 0.5% to 1% (should be higher than the deviation).

Discussion

0xRobocop

Escalate for 10 USDC

This is not an issue, it assumes that a "real-time" price exists which is theoretically impossible. In reality there is no way to value a collateral precisely to a "real-time" price because this "price" does not exists and the markets are aligned thanks to arbitrageurs.

We cannot say that the chainlink price (if chainlink is behaving properly and contract consumes the prices safely) is below or above the "market-price", because there is no such "market-price", what we can say is that some market has a different price than chainlink's oracle. For example the ETH / DAI uniswap pool may have the price of 1 ETH for 996 DAI and chainlink's price may be 1 ETH for 1000 DAI. Watson argues that this scenario will:

cause the quality of the collateral for USSD to continuously decrease and the value to be leaked to the arbitragers.

Which is not true, what will happen is the next:

    1. User will send 1 ETH to the USSD protocol and receive 1000 USSD.
    1. User will change 1000 USSD for 1000 DAI.
    1. User will buy ETH in uniswap with the 1000 DAI and receive 1.004 ETH, driving up the price of ETH in uniswap.
    1. User will repeat the process until the uniswap price is equal to the chainlink price and the arbitrage is no longer possible.
    1. ETH price increased in the "below-price" market, making the ETH collateral of the USSD protocol more valuable across different markets.

sherlock-admin

Escalate for 10 USDC

This is not an issue, it assumes that a "real-time" price exists which is theoretically impossible. In reality there is no way to value a collateral precisely to a "real-time" price because this "price" does not exists and the markets are aligned thanks to arbitrageurs.

We cannot say that the chainlink price (if chainlink is behaving properly and contract consumes the prices safely) is below or above the "market-price", because there is no such "market-price", what we can say is that some market has a different price than chainlink's oracle. For example the ETH / DAI uniswap pool may have the price of 1 ETH for 996 DAI and chainlink's price may be 1 ETH for 1000 DAI. Watson argues that this scenario will:

cause the quality of the collateral for USSD to continuously decrease and the value to be leaked to the arbitragers.

Which is not true, what will happen is the next:

    1. User will send 1 ETH to the USSD protocol and receive 1000 USSD.
    1. User will change 1000 USSD for 1000 DAI.
    1. User will buy ETH in uniswap with the 1000 DAI and receive 1.004 ETH, driving up the price of ETH in uniswap.
    1. User will repeat the process until the uniswap price is equal to the chainlink price and the arbitrage is no longer possible.
    1. ETH price increased in the "below-price" market, making the ETH collateral of the USSD protocol more valuable across different markets.

You've created a valid escalation for 10 USDC!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

twicek

Escalate for 10 USDC

I agree with the comments made by 0xRobocop, this report describe a common scenario that lead to an arbitrage opportunity, which is not an issue. Hitting the deviation threshold will lead for the price to be updated earlier than usual which will naturally lead to the arbitrage opportunity described by 0xRobocop. Adding a minting fee could actually be more detrimental since it would prevent arbitrager from getting the USSD / DAI Pool to equilibrium.

sherlock-admin

Escalate for 10 USDC

I agree with the comments made by 0xRobocop, this report describe a common scenario that lead to an arbitrage opportunity, which is not an issue. Hitting the deviation threshold will lead for the price to be updated earlier than usual which will naturally lead to the arbitrage opportunity described by 0xRobocop. Adding a minting fee could actually be more detrimental since it would prevent arbitrager from getting the USSD / DAI Pool to equilibrium.

You've created a valid escalation for 10 USDC!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

ctf-sec

Agree with the escalation.

hrishibhat

Result: Medium Unique Considering this a valid medium. Lead Watson comment:

comment is basically describing the arbitrage CAN happen, the missing part there is ETH/DAI is a much deeper pool than USSD/DAI, the USSD/DAI pool will suffer a much bigger damage before the arbitrage opportunity disappears. This is not a common/natural scenario

sherlock-admin

Escalations have been resolved successfully!

Escalation status:

The original report as published on Sherlock, by WATCHPUG. 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 absence of a minting fee allows arbitrageurs to profit from the difference between the oracle price and the market price, as the oracle price is not real-time and can deviate.

Impact

The collateral quality for USSD could continuously decrease and value could be leaked to arbitrageurs, although the arbitrage opportunity may diminish as market prices align.

What the attacker needed

Oracle price deviates from market price; No minting fee

The fix

The protocol should be fixed by adding a minting fee of 0.5% to 1%, which should be higher than the oracle deviation threshold.

How it was found

  1. Send 1 ETH to the USSD protocol and receive 1000 USSD.
  2. Exchange 1000 USSD for 1000 DAI.
  3. Buy ETH on Uniswap with the 1000 DAI, receiving 1.004 ETH and driving up the ETH price on Uniswap.
  4. Repeat the process until the Uniswap price equals the Chainlink price, making arbitrage no longer possible.

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.

The protocol lets you create a stablecoin (USSD) by locking up collateral like WETH. It uses a price feed (oracle) to decide how much USSD you get. Because the oracle price can be slightly different from the real market price and there is no fee, someone can repeatedly mint USSD when the oracle price is higher than the market price, sell the USSD, and make a profit at the protocol's expense.

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 WatchPug

View all

197 more disclosed reports, best first.

More from USSD - Autonomous Secure Dollar

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.