Open sherlock-admin4 opened 3 weeks ago
This issue is the complete opposite of #194. Thus, one of the issues should be invalidated as they contradict each other.
Escalate based on the above comment
Escalate based on the above comment
You've created a valid escalation!
To remove the escalation from consideration: Delete your comment.
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
Incorrect example.
- An liquidator/attacker observes an unhealthy positions and calls
PositionManager.liquidate
and repays just enough debt such that after liquidations0 < the new position's debt < minDebt
.
Due to this check
function repay(uint256 poolId, address position, uint256 amt) external returns (uint256 remainingShares) {
---
// revert if repaid amt is too small
if (borrowShares == 0) revert Pool_ZeroSharesRepay(poolId, amt);
// check that final debt amount is greater than min debt
remainingShares = borrowSharesOf[poolId][position] - borrowShares;
if (remainingShares > 0) {
uint256 newBorrowAssets = _convertToAssets(
remainingShares, pool.totalBorrowAssets - amt, pool.totalBorrowShares - borrowShares, Math.Rounding.Down
);
@> if (_getValueOf(pool.asset, newBorrowAssets) < minDebt) {
@> revert Pool_DebtTooLow(poolId, pool.asset, newBorrowAssets);
@> }
}
It is impossible to repay in the the described way.
AlexCzm
Medium
Missing 'minDebt' check from liquidation can lead to bad debt accumulation
Summary
The missing
minDebt
check fromPositionManager.liquidate
can leave positions with a small amount of debt that is unappealing to further liquidations and can lead to accumulation of bad debt.Root Cause
Protocol implements a
borrowAssets < minDebt
check inPool.borrow
(link) andPool.repay
(link2), but this check is missing from liquidations.Internal pre-conditions
External pre-conditions
none
Attack Path
PositionManager.liquidate
and repays just enough debt such that after liquidations0 < the new position's debt < minDebt
.Impact
Protocol can have many positions with
debt < minDebt
. Over time, since there will be no incentive for liquidators to liquidate small underwater positions given the gas cost, protocol accumulates bad debt at the detrimental of lenders.PoC
No response
Mitigation
Ensure that liquidators liquidate entire position's debt or, that the remaining debt after liquidation is bigger than
minDebt
.