15,000 USDC
View results
Submission Details
Severity: medium

DSCEngine.burnDsc don't allow user to decrease it debt when it's under liquidation

Summary

DSCEngine.burnDsc don't allow user to decrease it debt when it's under liquidation.

Vulnerability Details

DSCEngine.burnDsc allows user to repay his debt. He sends stablecoin, which is than burnt and user debt has decreased.
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L212-L215

function burnDsc(uint256 amount) public moreThanZero(amount) {
_burnDsc(amount, msg.sender, msg.sender);
_revertIfHealthFactorIsBroken(msg.sender); // I don't think this would ever hit...
}

As you can see, after user did that there is health factor check. In case if user was not under liquidation or became such after repay, then tx will proceed. But in case if user still under liquidation(has bad health factor), then tx will revert.
Because of that, user with bad health factor can't repay small amount of debt. This is not ok, because in such way they can decrease amount of their collateral that can will be taken to the liquidator.

Impact

User under liquidation can't decrease his debt.

Tools Used

VsCode

Recommendations

I do not see the reason to have health factor check after user repays.

Support

FAQs

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