Skip to content
This repository has been archived by the owner on Jul 14, 2024. It is now read-only.

shaka - The depegging of the collateral token from the USD could result in the Ubiquity Dollar token being undercollateralized #19

Closed
sherlock-admin opened this issue Jan 10, 2024 · 2 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Jan 10, 2024

shaka

high

The depegging of the collateral token from the USD could result in the Ubiquity Dollar token being undercollateralized

Summary

The depegging of the collateral token from the USD could result in the Ubiquity Dollar token being undercollateralized.

Vulnerability Detail

The amount of Ubiquity Dollar tokens minted or redeemed is based on the USD value of the collateral at the time of minting or redeeming.

This can easily result in the Ubiquity Dollar token being under collateralized due to the price of the collateral tokens depegging from the USD.

Let's assume the following scenario, with no protocol fees for simplicity:

  • Alice mints 1,000 tokens with DAI as collateral. Being at the moment the price of DAI 1.01 USD, she deposits 990.09901 DAI (1,000 / 1.01).
  • The price of DAI stabilizes at 1.00 USD. Now we have 1,000 Ubiquity Dollar tokens backed by 990.09901 USD.
  • Alice tries to redeem her 1,000 Ubiquity Dollar tokens, but the transaction fails as the total collateral is worth less than 1,000 USD.

A similar problem could arise if the price of the collateral is 1 USD at the time of minting and below 1 USD at the time of redeeming.

To give a realistic example of how this could affect the protocol, let's get the price feed of LUSD/USD at roundId 18446744073709556509, that returns the answer 105421019. All the tokens minted with LUSD as collateral at that moment would have ended up being 5.42% undercollateralized once the price of LUSD stabilized at 1 USD.

Impact

The protocol could end up being undercollateralized, which could result in the loss of funds for the users.

Code Snippet

https://github.com/sherlock-audit/2023-12-ubiquity/blob/main/ubiquity-dollar/packages/contracts/src/dollar/libraries/LibUbiquityPool.sol#L355

https://github.com/sherlock-audit/2023-12-ubiquity/blob/main/ubiquity-dollar/packages/contracts/src/dollar/libraries/LibUbiquityPool.sol#L435

Tool used

Manual Review

Recommendation

A possible solution would be checking that the collateral token is between a certain range of prices at the time of minting and redeeming. This could at least minimize the impact of high deviations from the USD price. Another safety measure could be limiting the amount of tokens minted or redeemed depending on the deviation of the price of the collateral token.

Duplicate of #17

@github-actions github-actions bot added the Excluded Excluded by the judge without consulting the protocol or the senior label Jan 14, 2024
@sherlock-admin2
Copy link
Contributor

1 comment(s) were left on this issue during the judging contest.

auditsea commented:

The issue describes about the protocol insolvancy in case of collateral depeg. It's not avoidable, that's why the protocol has borrowing function to get yield, take fees on mint and redeem, these features will hedge the risk from protocol insolvancy

@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label and removed Excluded Excluded by the judge without consulting the protocol or the senior labels Jan 16, 2024
@sherlock-admin2
Copy link
Contributor

1 comment(s) were left on this issue during the judging contest.

auditsea commented:

The issue describes about the protocol insolvancy in case of collateral depeg. It's not avoidable, that's why the protocol has borrowing function to get yield, take fees on mint and redeem, these features will hedge the risk from protocol insolvancy

@sherlock-admin sherlock-admin changed the title Dancing Vinyl Sawfish - The depegging of the collateral token from the USD could result in the Ubiquity Dollar token being undercollateralized shaka - The depegging of the collateral token from the USD could result in the Ubiquity Dollar token being undercollateralized Jan 24, 2024
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Jan 24, 2024
@Czar102 Czar102 removed the Medium A valid Medium severity issue label Feb 14, 2024
@sherlock-admin sherlock-admin added Non-Reward This issue will not receive a payout and removed Reward A payout will be made for this issue labels Feb 14, 2024
@Czar102 Czar102 added the Medium A valid Medium severity issue label Feb 19, 2024
@sherlock-admin sherlock-admin added Reward A payout will be made for this issue and removed Non-Reward This issue will not receive a payout labels Feb 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

3 participants