Skip to content
Business logic Audit finding Intermediate

Malicious refinancing attack could lead to suboptimal NFT liquidation

Refinancing a loan is permissionless and does not check the liquidationInitialAsk parameter, so an attacker can refinance just before liquidation with a very low initial ask. This could cause the borrower's NFT to be liquidated at a price far below its fair value, benefiting the attacker.

gtocoder Follow with peakbolt

Originally disclosed on Code4rena

Submitted by gtocoder, also found by peakbolt

https://github.com/code-423n4/2023-01-astaria/blob/main/src/AstariaRouter.sol#L684

A malicious refinancing with a very low liquidationInitialAsk just prior to a liquidation event could result in an NFT being liquidated for a price much lower than what the borrower wanted when signing up for the loan. Because refinancing is permission less, anyone can do this close to liquidation event resulting in the user being compensated less than fair price for their NFT.

Proof of Concept

Refinance checks are currently permission less, anyone can buyout a lien. This is fine because of the assumption that refinancing leads to a strictly optimal outcome in all cases to the borrower. This is true with respect to the loan duration, interest rate and overall debt parameters. However this is not the case with respect to the liquidationInitialAsk loan parameter.

See code in https://github.com/code-423n4/2023-01-astaria/blob/main/src/AstariaRouter.sol#L684 refinance checks do not take into account liquidationInitialAsk which is one of the loan parameters

Imagine a user takes a loan for 3 ETH against an NFT with a high liquidationInitialAsk of 100 ETH which is a fair value of the NFT to the user. If they are not able to pay off the loan in time, they are assured ~97 ETH back assuming market conditions do not change. However a malicious refinancing done close to liquidation can set liquidationInitialAsk close to 0.

This is possible because:

  • Refinancing is permission less
  • Since it’s close to liquidation, user has no time to react

The malicious liquidator just needs to pay off the debt of 3 ETH and a minimal liquidation fee. Further, since they are aware of the initial ask in the NFT auction, they may be able to purchase the NFT for a very low price. The liquidator profits and the initial borrower does not receive a fair market value for their collateral.

Recommended Mitigation Steps

  • Add checks that liquidationInitialAsk does not decrease during a refinance. Or set a minimumLiquidationPrice which is respected across all refinances
  • Don’t allow refinances close to a liquidation event
  • Don’t allow loans / refinances less than a minimum duration. May prevent other classes of surprises as well.

SantiagoGregory (Astaria) confirmed via duplicate issue #470


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

Likely the refinance logic does not validate or preserve the liquidationInitialAsk parameter, allowing a permissionless refinancer to lower it arbitrarily.

Impact

The borrower could receive much less than fair market value for their collateral, while the attacker profits; the text does not mention any defence that would block this.

What the attacker needed

Permissionless refinancing; refinance close to liquidation; attacker can pay off debt and fee

The fix

The protocol should add checks that liquidationInitialAsk does not decrease during refinancing, or enforce a minimum liquidation price across refinances.

How it was found

  1. A borrower takes a loan against an NFT with a high liquidationInitialAsk.
  2. Close to the liquidation event, an attacker refinances the loan and sets liquidationInitialAsk close to zero.
  3. The attacker pays off the debt and a minimal liquidation fee.
  4. The NFT is auctioned starting from the very low ask, and the attacker may buy it cheaply.

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 puts up an NFT as collateral for a loan and sets a starting price for an auction if they fail to repay. Anyone can take over (refinance) the loan, but the system does not check that the new starting price is still fair. An attacker can take over the loan just before it is due and set the starting price very low, so the NFT sells cheaply and the borrower loses out.

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 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.