sherlock-audit / 2024-04-teller-finance-judging

6 stars 6 forks source link

0xDjango - Liquidations in the Lender Commitment Group don't include owed interest #293

Closed sherlock-admin2 closed 2 months ago

sherlock-admin2 commented 2 months ago

0xDjango

medium

Liquidations in the Lender Commitment Group don't include owed interest

Summary

Liquidations in LenderCommitmentGroup_Smart.sol do not include the owed interest. This creates a weird dynamic where it may be beneficial for a borrower to default the loan and self-liquidate intead of paying the owed interest.

Vulnerability Detail

When liquidating a loan in the LendeCommitmentGroup contract, the amountOwed is calculated as such:

        uint256 amountDue = getAmountOwedForBid(_bidId, false);
    function getAmountOwedForBid(uint256 _bidId, bool _includeInterest)
        public
        view
        virtual
        returns (uint256 amountOwed_)
    {
        Payment memory amountOwedPayment = ITellerV2(TELLER_V2)
            .calculateAmountOwed(_bidId, block.timestamp);

        amountOwed_ = _includeInterest
            ? amountOwedPayment.principal + amountOwedPayment.interest
            : amountOwedPayment.principal;
    }

Since liquidations do not include owed interest, it may be financially incentivized for borrowers to intentionally default their loans and liquidate themselves instead, given that there is no penalty or protocol fee taken from liquidations.

Impact

Code Snippet

https://github.com/sherlock-audit/2024-04-teller-finance/blob/main/teller-protocol-v2-audit-2024/packages/contracts/contracts/LenderCommitmentForwarder/extensions/LenderCommitmentGroup/LenderCommitmentGroup_Smart.sol#L426

Tool used

Manual Review

Recommendation

Duplicate of #121