Skip to content
Business logic Audit finding Intermediate

Borrower can use liquidationInitialAsk to block future borrowers

A borrower can set their liquidationInitialAsk equal to their loan amount, causing any future borrows to fail because the contract checks that the total potential debt does not exceed each lien's liquidationInitialAsk. This blocks the borrower from taking additional loans.

obront Follow

Originally disclosed on Code4rena

Submitted by obront

https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/LienToken.sol#L471-L489 https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/LienToken.sol#L153-L174

When a new lien is taken (or bought out), one of the validations is to ensure that the potentialDebt of each borrower on the stack is less than or equal to their liquidationInitialAsk.

if (potentialDebt > newStack[j].lien.details.liquidationInitialAsk) {
    revert InvalidState(InvalidStates.INITIAL_ASK_EXCEEDED);
  }

In _appendStack() and _buyoutLien(), this is performed by iterating through the stack backwards, totaling up the potentialDebt, and comparing it to each lien’s liquidationInitialAsk:

for (uint256 i = stack.length; i > 0; ) {
      uint256 j = i - 1;
      newStack[j] = stack[j];
      if (block.timestamp >= newStack[j].point.end) {
        revert InvalidState(InvalidStates.EXPIRED_LIEN);
      }
      unchecked {
        potentialDebt += _getOwed(newStack[j], newStack[j].point.end);
      }
      if (potentialDebt > newStack[j].lien.details.liquidationInitialAsk) {
        revert InvalidState(InvalidStates.INITIAL_ASK_EXCEEDED);
      }

      unchecked {
        --i;
      }
    }

However, only the first item on the stack has a liquidationInitialAsk that matters. When a new auction is started on Seaport, Router#liquidate() uses stack[0].lien.details.liquidationInitialAsk as the starting price. The other values are meaningless, except in their ability to DOS future borrowers.

Proof of Concept

  • I set my liquidationInitialAsk to be exactly the value of my loan
  • A borrower has already borrowed on their collateral, and the first loan on the stack will determine the auction price
  • When they borrow from me, my liquidationInitialAsk is recorded
  • Any future borrows will check that futureBorrow + myBorrow <= myLiquidationInitialAsk, which is not possible for any futureBorrow > 0
  • The result is that the borrower will be DOS’d from all future borrows

This is made worse by the fact that liquidationInitialAsk is not a variable that can justify a refinance, so they’ll need to either pay back the loan or find a refinancier who will beat one of the other terms (rate or duration) in order to get rid of this burden.

Recommended Mitigation Steps

Get rid of all checks on liquidationInitialAsk except for comparing the total potential debt of the entire stack to the liquidationInitialAsk of the lien at position 0.

Picodes (judge) commented:

The scenario is correct but I don’t think it is of high severity at first sight, considering setting liquidationInitialAsk too low only exposes the lender to a potential bad debt if the dutch auction settles below its debt

Picodes (judge) commented:

However, it seems from this and other findings that leaving the liquidationInitialAsk at the lien level has multiple unintended side effects.

SantiagoGregory (Astaria) confirmed


The original report as published on Code4rena, by obront. 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

Root cause

The contract enforces the liquidationInitialAsk limit on every lien in the stack, even though only the first lien's value is used for auctions, allowing a borrower to set a restrictive value that blocks future borrows.

Impact

The borrower is blocked from all future borrows and must repay the loan or find a refinancier to remove the restriction.

What the attacker needed

Borrower has an existing loan; attacker is a lender; attacker sets liquidationInitialAsk equal to loan value

The fix

The checks on liquidationInitialAsk should be removed except for comparing the total potential debt of the entire stack to the liquidationInitialAsk of the lien at position 0.

How it was found

  1. Set the liquidationInitialAsk to exactly the value of the loan.
  2. Borrow from the lender, recording the liquidationInitialAsk.
  3. Attempt any future borrow; the check fails because futureBorrow + myBorrow exceeds myLiquidationInitialAsk.

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 this lending system, each loan on a borrower's stack has a starting auction price called liquidationInitialAsk. The code checks that the total debt does not exceed this price for every loan, but only the first loan's price actually matters for auctions. A borrower can set their price exactly equal to their loan, so any new loan would make the total debt exceed that price and be rejected, locking them out of future borrowing.

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 obront

View all

46 more disclosed reports, best first.

More from Astaria contest

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.