Closed c4-bot-3 closed 5 months ago
Somewhat incomplete, maybe partial dup of small bad debt positions, but maybe scrap due to low quality
GalloDaSballo marked the issue as insufficient quality report
trust1995 marked the issue as unsatisfactory: Insufficient quality
Lines of code
https://github.com/code-423n4/2024-02-wise-lending/blob/79186b243d8553e66358c05497e5ccfd9488b5e2/contracts/WiseLending.sol#L1250-L1309 https://github.com/code-423n4/2024-02-wise-lending/blob/79186b243d8553e66358c05497e5ccfd9488b5e2/contracts/WiseSecurity/WiseSecurityHelper.sol#L876-L900
Vulnerability details
Impact
Not enforcing full liquidation leads to bad debt in the system and gives on incentive to liquidate small positions.
Proof of Concept
When liquidations are made, in
WiseCore._coreLiquidation()
, the percentage of reward for the liquidator is calculated and checked if it doesn't go over 1e18 (100%):later, the amount to receive is calculated based on this percentage:
The problem is that there is check if the position is not liquidated over 100%, but there is no check if the position liquidation leaves dust amounts of bad debt. Additionally, inside both
_calculatePotentialPureExtraCashout()
and_withdrawPureCollateralLiquidation()
it can round down to 0, leaving liquidator with no incentive to liquidate such position, increasing bad debt. So, the bad debt will slowly, but constantly increase.Tools Used
Manual Review
Recommended Mitigation Steps
Consider enforcing full position liquidation when position can be liquidated in 100% due to bad debt.
Assessed type
Invalid Validation