Cyfrin / 2023-07-foundry-defi-stablecoin

37 stars 32 forks source link

Redundant healthy position check #1115

Open codehawks-bot opened 1 year ago

codehawks-bot commented 1 year ago

Redundant healthy position check

Severity

Medium Risk

Summary

liquidate() function can revert when shouldn't.

Vulnerability Details

liquidate() function has a msg.sender's healthy position check at the end of the execution. However, it shouldn't be there as the msg.sender's position has no relation to the liquidated one. Hence, the liquidation can revert when shouldn't. Also, the person that has such an issue can borrow such amount of assets to make the position liquidatable, transfer them to another wallet and call the liquidate() there and it won't revert.

Impact

The liquidation transaction can revert when not expected.

Tools Used

Manually

Recommendations

Remove this check.