Skip to content
Business logic Audit finding Intermediate

bad debt is not accounted for during partial liquidation of an insolvent position

The protocol allows partial liquidation of an insolvent position, but does not account for the resulting bad debt. This leaves the loss to be borne by remaining protocol users.

0xpetern Follow with TessKimy, ifeco445 and 2 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-05-lend-audit-contest-judging/issues/660

Found by

0xpetern, TessKimy, ifeco445, rudhra1749, theweb3mechanic

Summary

https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/713372a1ccd8090ead836ca6b1acf92e97de4679/Lend-V2/src/LayerZero/CoreRouter.sol#L230-L245

Solidity
    function liquidateBorrow(address borrower, uint256 repayAmount, address lTokenCollateral, address borrowedAsset)
        external
    {
        // The lToken of the borrowed asset
        address borrowedlToken = lendStorage.underlyingTolToken(borrowedAsset);


        LTokenInterface(borrowedlToken).accrueInterest();


        (uint256 borrowed, uint256 collateral) =
            lendStorage.getHypotheticalAccountLiquidityCollateral(borrower, LToken(payable(borrowedlToken)), 0, 0);


        liquidateBorrowInternal(
            msg.sender, borrower, repayAmount, lTokenCollateral, payable(borrowedlToken), collateral, borrowed
        );
    }


protocol allows for partial liquidation, if a borrowers position is insolvent then a liquidator can liquidate him leaving bad debt to protocol.And there is no bad debt accounting mechanism in protocol, due to which protocol users should bare this bad debt loss

Root Cause

no mechanism to account for bad debt .

Internal Pre-conditions

none

External Pre-conditions

none

Attack Path

liquidator liquidates a undercollaterized insolvent borrow position due to which bad debt accures.

Impact

as there is no mechanism to account for bad debt of protocol this loss will be effected to remaining protocol users

PoC

No response

Mitigation

implement a mechanism for bad debt accounting

The original report as published on Sherlock, by 0xpetern. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the liquidation logic does not track or socialise bad debt when a position is partially liquidated and remains insolvent.

Impact

The bad debt from an insolvent liquidation is not accounted for, so the loss could be borne by remaining protocol users.

What the attacker needed

An insolvent borrow position exists; a liquidator performs partial liquidation

The fix

A mechanism for bad debt accounting should be implemented.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In a lending protocol, if a borrower's collateral is worth less than their debt, the position is insolvent. A liquidator can repay part of the debt and take collateral, but if the collateral is not enough to cover the debt, the remaining unpaid amount is 'bad debt'. This report says the protocol has no way to record or handle that bad debt, so other users effectively absorb the loss.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by 0xpetern

View all

9 more disclosed reports, best first.

More from LEND

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.