Skip to content
Business logic Audit finding Intermediate

LienToken.createLien doesn't check if user should be liquidated and provides new loan

The createLien function assumed that a missing auction meant the borrower was safe to receive a new loan, but an auction only exists once someone calls the liquidate function. An attacker could therefore obtain a new loan for a borrower who had already defaulted and should have been liquidated.

rvierdiiev Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-10-astaria-judging/issues/66

Found by

rvierdiiev

Summary

LienToken.createLien doesn't check if user should be liquidated and provides new loan if auction do not exist for collateral.

Vulnerability Detail

LienToken.createLien relies on AuctionHouse to check if new loan can be added to borrower. It assumes that if auction doesn't exist then user is safe to take new loan.

The problem is that to start auction with token that didn't pay the debt someone should call AstariaRouter.liquidate function. If no one did it then auction for the NFT will not exists, and LienToken.createLien will create new Lien to user, while he already didn't pay debt and should be liquidated.

Impact

New loan will be paid to user that didn't repay previous lien.

Code Snippet

Provided above

Tool used

Manual Review

Recommendation

Check if user can be liquidated through all of his liens positions. If not then only proceed with new loan.

Discussion

IAmTurnipBoy

Escalate for 1 USDC

Disagree with high severity. User would have to voluntarily sign a lien for another user who is already late on their payments (should raise some red flags), should only be medium or low given external circumstances

sherlock-admin

Escalate for 1 USDC

Disagree with high severity. User would have to voluntarily sign a lien for another user who is already late on their payments (should raise some red flags), should only be medium or low given external circumstances

You've created a valid escalation for 1 USDC!

To remove the escalation from consideration: Delete your comment. To change the amount you've staked on this escalation: Edit your comment (do not create a new comment).

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

Evert0x

Escalation accepted.

sherlock-admin

Escalation accepted.

This issue's escalations have been accepted!

Contestants' payouts and scores will be updated according to the changes made on this issue.

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

Impact

A new loan could be issued to a borrower who had not repaid a previous lien, though the escalation notes that someone must voluntarily sign the new lien, which limits the severity.

What the attacker needed

Borrower already in default; no one has called liquidate yet; someone signs the new lien

The fix

The contract should check whether the borrower can be liquidated across all of their lien positions and only allow a new loan if none of them are in default.

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 borrower who stops repaying a loan is supposed to be liquidated, meaning their collateral is sold to cover the debt. But the contract only starts that sale when someone explicitly triggers it, so until then the system wrongly treats the borrower as healthy and lets them take another loan.

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 rvierdiiev

View all

72 more disclosed reports, best first.

More from Astaria

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.