Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USDMPegRecovery Will Most Certainly Lead To Failed Withdrawals When All Supplied Liquidity Is Removed #93

Closed
code423n4 opened this issue Feb 8, 2022 · 1 comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-02-concur/blob/main/contracts/USDMPegRecovery.sol

Vulnerability details

Impact

The USDMPegRecovery contract intends to bootstrap the usdm3crv Curve liquidity pool such that USDM can recover its peg. Users are allowed to deposit and withdraw their usdm and pool3 tokens to contribute to the peg recovery process. Upon depositing, the contract will update the user's usdm and pool3 token balance and the contract's total liquidity.

Guardians can then use deposited tokens to provide liquidity in multiples of the configured step amount which equates to 250000e18 tokens. However, the contract fails to consider two important things:

  • Fees are charged upon adding/removing liquidity.
  • The liquidity pool does not constitute an equal number of usdm/pool3 tokens.

As a result, it is almost impossible for users to withdraw all deposited tokens once all liquidity has been removed from the Curve pool. If there are more usdm tokens (after LP withdrawal) as compared to total.pool3, then some users will not be able to retrieve their initial pool3 token deposit.

Proof of Concept

https://github.com/code-423n4/2022-02-concur/blob/main/contracts/USDMPegRecovery.sol

Tools Used

Manual code review.

Recommended Mitigation Steps

Consider accounting for the incorrect assumption that once all liquidity is removed, the contract will receive usdm and pool3 tokens equal to or greater than total.usdm and total.pool3 respectively.

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Feb 8, 2022
code423n4 added a commit that referenced this issue Feb 8, 2022
@leekt leekt added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Feb 18, 2022
@GalloDaSballo
Copy link
Collaborator

Duplicate of #70

@GalloDaSballo GalloDaSballo marked this as a duplicate of #70 Apr 12, 2022
@GalloDaSballo GalloDaSballo added the duplicate This issue or pull request already exists label Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

3 participants