Skip to content
Business logic Audit finding Intermediate

Buyouts of shorter duration liens can lead to the loss of borrower funds

Liens with duration equal to or less than minDurationIncrease cannot be bought out because the check requires waiting minDurationIncrease, which would cause the lien to expire and trigger an underflow. This locks borrowers out of better-termed liens, causing them to pay extra interest and lose funds.

0xRajeev Follow

Originally disclosed on Sherlock

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

Found by

0xRajeev

Summary

Liens whose duration is equal to (or maybe less than) minDurationIncrease cannot be bought out to be replaced by newer liens with lower interest rates but the same duration. This locks the borrower out of better-termed liens, effectively resulting in the loss of their funds

Vulnerability Detail

Liens whose duration is equal to (or maybe less than) minDurationIncrease cannot be bought out to be replaced by newer liens with lower interest rates but the exact duration because it results in an underflow in _getRemainingInterest().

Example scenario: if the strategyliendetails.duration is <= 14 days, then it's impossible to do a buyout of a new lien because the implemented check requires to wait minDurationIncrease, which is set to 14 days. However, if the buyer waits 14 days, the lien is expired, which triggers the earlier mentioned underflow.

Impact

The borrower gets locked out of better-termed liens, effectively resulting in the loss of their funds because of extra interest paid on older liens.

Code Snippet

  1. https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/LienToken.sol#L573
  2. https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/AstariaRouter.sol#L489-L490

Tool used

Manual Review

Recommendation

Revisit the checking logic and minimum duration as it applies to shorter-duration loans.

Discussion

SantiagoGregory

We updated buyoutLien() to check for a lower interest rate or higher duration.

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

Root cause

Likely the buyout check requires a minimum duration increase that is not compatible with short-duration liens, leading to an underflow when the lien expires.

Impact

The borrower gets locked out of better-termed liens, effectively resulting in the loss of their funds because of extra interest paid on older liens.

What the attacker needed

Lien duration <= minDurationIncrease; minDurationIncrease set to 14 days

The fix

The buyoutLien() function was updated to check for a lower interest rate or higher duration.

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 takes a loan (lien) with a certain duration and interest rate. If a better loan with lower interest becomes available, the borrower might want to replace the old loan, but the system prevents this for short-duration loans because the required waiting period would make the old loan expire and cause a calculation error. As a result, the borrower is stuck with the worse loan and pays more interest.

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 0xRajeev

View all

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