Skip to content
Business logic Audit finding Intermediate

Small loans will never be liquidated, generating bad debt for lenders

The protocol has no minimum loan size, so a borrower can open many tiny loans in one transaction. When the loan-to-value ratio exceeds 90%, liquidating each small loan costs more in transaction fees than it recovers, so lenders are left with bad debt.

DadeKuma Follow with adeolu

Originally disclosed on Code4rena

Submitted by DadeKuma, also found by adeolu

There isn’t a minimum position requirement for borrowers when they start a loan. Malicious borrowers might abuse this to create a large amount of small loans that will be unprofitable to liquidate. This results in a total loss of funds for lenders as they will get only bad debt.

Proof of Concept

  1. A malicious borrower starts (src/processor/swap.rs#L12) multiple loans with extremely low amounts of funds borrowed in each one, in a single transaction (by chaining borrow - add_collateral - borrow - ... with different positions on the same pool). They get the same amount of funds as they would have got with a single big loan AND they pay just for a single transaction.
  2. When the LTV goes > 90%, the lender should liquidate (src/processor/liquidate.rs#L19) each of these loans, but it will be unprofitable to do so, as they NEED to execute and pay for multiple transactions.
  3. The lender will never liquidate all the loans (as it’s unprofitable) so they only get bad debt.

Recommended Mitigation Steps

Consider implementing a minimum amount to start a loan.

Assessed type

Invalid Validation

piske-alex (Lavarage) confirmed

alcueca (judge) decreased severity to Medium

Note: For full discussion, see here.


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

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

Impact

Lenders could suffer a total loss of funds because the small loans are never liquidated and only bad debt remains.

What the attacker needed

Ability to open a loan on the pool; borrower willing to pay one transaction fee

The fix

A minimum loan amount should be enforced so that each position is large enough to make liquidation worthwhile.

How it was found

  1. A borrower opens many very small loans in one transaction by chaining borrow and add_collateral calls on the same pool.
  2. The borrower receives the same total funds as one large loan but pays only one transaction fee.
  3. When the LTV passes 90%, each loan would need its own liquidation transaction.
  4. Liquidating all the small loans costs more than it recovers, so they are left unliquidated and become bad debt.

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.

A loan is backed by collateral, and if the collateral's value falls too far, someone (the lender) is supposed to sell it to get the money back. Here, a borrower can split one big loan into many tiny loans in a single transaction. Each tiny loan is too small to be worth the cost of selling its collateral, so nobody does it and the lender loses money.

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 DadeKuma

View all

19 more disclosed reports, best first.

More from Lavarage Invitational

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.