15,000 USDC
View results
Submission Details
Severity: high

DSC token won't cost $1

Summary

Each user may deposit assets to the protocol and mint DecentralizedStableCoin (DSC) token.
DSC token is ERC-20 burnable token that may be used as usual ERC-20.

Vulnerability Details

As DSC token is standard ERC-20 token, it may be transferred to other users via transfer/transferFrom function and used in any DeFi or any other activity.
DSC token price is pegged to 1 USD, current mint/burn mechanism must protect it from any possible fluctuation. But it won't actually protect DSC.

Current contract implementation allows DSC burning only for user's who previously mint DSC, as their value stored in s_collateralDeposited mapping.

s_collateralDeposited[from][tokenCollateralAddress] -= amountCollateral;

Impact

Possible impact:

  • DSC will cost much higher then 1 USD. If some actor gets significant amount of DSC from open market, DSC minters will be forced to pay extra cost to get back their 2 USD collateral from protocol. Effectively move DSC price up to 1.99 USD

  • DSC will cost much lower then 1 USD. DSC bought on open market or received in other way may not be redeemed and users may be discourage to use it and lower the demand and thus price for DSC.

Tools Used

Observation, foundry unit test

function testCanRedeemCollateralOfReceivedDsc() public depositedCollateralAndMintedDsc {
address user2 = address(2);
uint256 user_dsc_balance = dsc.balanceOf(user);
vm.startPrank(user);
dsc.transfer(user2, user_dsc_balance);
vm.stopPrank();
vm.startPrank(user2);
dsce.redeemCollateral(weth, amountCollateral);
uint256 userBalance = ERC20Mock(weth).balanceOf(user2);
assertEq(userBalance, amountCollateral);
vm.stopPrank();
}

Result - underflow as we are trying to divide redeem amount from zero

[FAIL. Reason: Arithmetic over/underflow] testCanRedeemCollateralOfReceivedDsc() (gas: 266799)
Test result: FAILED. 0 passed; 1 failed; finished in 2.90ms

Recommendations

Contract must be updated to allow direct DSC exchangeable to collateral assets.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.