Skip to content
Audit finding Advanced

Oracle price should be denominated in DAI instead of USD

The protocol's oracles return prices in USD, but the system aims to maintain a peg to DAI. When DAI is over-pegged, an attacker can mint USSD at the USD price, sell it for DAI, and trigger rebalancing to extract profit, draining collateral.

T1MOH Follow with WATCHPUG

Originally disclosed on Sherlock

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

Found by

T1MOH, WATCHPUG

Summary

Vulnerability Detail

Per the whitepaper, USSD aims to be pegged to DAI.

The implementation of rebalancer is also using the DAI price of USSD (getOwnValuation()) as the target of the peg.

However, all current oracles return the price denominated in USD.

Additionally, all collateral tokens can be used to mint at the oracle price with no fee.

As a result, when DAI is over-pegged, the system will automatically drive itself away from the peg to DAI. The proof of concept for this is as follows:

When the DAI price is 1.1 (over-pegged), and the system is actively maintaining its peg to DAI, the user can:

  1. Mint 1100 USSD with 1000 DAI (worth 1100 USD).
  2. Sell 1100 USSD for 1100 DAI, driving the USSD to a lower price against DAI, say 1 USSD to 0.98 DAI.
  3. Trigger the rebalance() function which sells collateral to DAI and buys back USSD to push its price back to 1:1 with DAI.

By repeating steps 1-3, the system will consume all its collateral, and the profit will be extracted by the arbitrator.

Impact

Code Snippet

https://github.com/sherlock-audit/2023-05-USSD/blob/main/ussd-contracts/contracts/oracles/StableOracleWETH.sol#L12-L27

Tool used

Manual Review

Recommendation

Change the unit of Oracle price from USD to DAI.

  • DAI should return 1
  • WBTC should use WBTC/ETH ETH/DAI
  • WETH should use WETH/DAI
  • WBGL should use WBGL/WETH ETH/DAI

Or, change the peg target from DAI to USD, which means the getOwnValuation() should not be used as the peg deviation check standard.

Discussion

0xJuancito

Escalate for 10 USDC

The report assumes that the attacker would be able to sell 1100 USSD for 1100 DAI:

  1. Sell 1100 USSD for 1100 DAI, driving the USSD to a lower price against DAI, say 1 USSD to 0.98 DAI.

This wouldn't be possible, as the USSD/DAI pool would be arbitraged and the attacker will only be losing money on each mint. It also assumes manipulating the price, which is already mentioned in https://github.com/sherlock-audit/2023-05-USSD-judging/issues/451.

This can be considered either informational or a duplicate

sherlock-admin

Escalate for 10 USDC

The report assumes that the attacker would be able to sell 1100 USSD for 1100 DAI:

  1. Sell 1100 USSD for 1100 DAI, driving the USSD to a lower price against DAI, say 1 USSD to 0.98 DAI.

This wouldn't be possible, as the USSD/DAI pool would be arbitraged and the attacker will only be losing money on each mint. It also assumes manipulating the price, which is already mentioned in https://github.com/sherlock-audit/2023-05-USSD-judging/issues/451.

This can be considered either informational or a duplicate

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

Emm do not see why this is not possible

Sell 1100 USSD for 1100 DAI, driving the USSD to a lower price against DAI, say 1 USSD to 0.98 DAI.

the attack path described is still valid in the original report

hrishibhat

Result: High Has duplicates The attack is possible and the rebalance is design to create maintain the 1:1 ratio between USSD to DAI.

sherlock-admin

Escalations have been resolved successfully!

Escalation status:

The original report as published on Sherlock, by T1MOH. 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 prices are denominated in USD while the peg target is DAI, causing a mismatch when DAI's price deviates from USD.

Impact

The system could consume all its collateral, with profit extracted by the attacker, when DAI is over-pegged.

What the attacker needed

DAI is over-pegged (e.g., price > 1 USD); Attacker has DAI to mint USSD; USSD/DAI market exists for selling

The fix

The oracle price unit should be changed from USD to DAI, or the peg target should be changed from DAI to USD.

How it was found

  1. Mint 1100 USSD with 1000 DAI (worth 1100 USD).
  2. Sell 1100 USSD for 1100 DAI, driving the USSD to a lower price against DAI, say 1 USSD to 0.98 DAI.
  3. Trigger the `rebalance()` function which sells collateral to DAI and buys back USSD to push its price back to 1:1 with DAI.
  4. Repeat steps 1-3 to consume all collateral and extract profit.

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 is a decentralised finance (DeFi) protocol that tries to keep its stablecoin USSD equal in value to another stablecoin, DAI. However, the price feeds it uses report values in US dollars, not DAI. When DAI is worth more than a dollar, someone can exploit this mismatch to make a profit at the protocol's expense.

More by T1MOH

View all

11 more disclosed reports, best first.

More from USSD - Autonomous Secure Dollar

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.