Skip to content
Business logic Audit finding Intermediate

Public vault strategist reward is not calculated correctly

The strategist interest reward in the public vault was calculated using the full remaining lien amount rather than the amount actually paid, so the strategist received more shares than deserved. A strategist could make a tiny payment on behalf of a borrower to trigger the inflated reward calculation.

evan Follow with PaludoX0

Originally disclosed on Code4rena

Submitted by evan, also found by PaludoX0

https://github.com/code-423n4/2023-01-astaria/blob/main/src/PublicVault.sol#L597-L609 https://github.com/code-423n4/2023-01-astaria/blob/main/src/LienToken.sol#L819

Strategist interest reward is not calculated correctly. The reward will almost always be calculated with interestOwed, regardless of the amount paid.

As a result, the strategist gets paid more than they are supposed to. Even if the borrower hasn’t made a single payment, the strategist can make a tiny payment on behalf of the borrower to trigger this calculation.

This also encourages the strategist to maximize interestOwed and make tiny payments on behalf of the borrower. This can trigger a compound interest vulnerability which I’ve made a separate report about.

Proof of Concept

As confirmed by the sponsor, the strategist reward is supposed to be “paid on performance and only@on interest. if the payment that’s being made is greater than the interest owing we only mint them based on the interest owed, but if it’s less, then, mint their shares based on the amount”

However, this is not the case. When LienToken calls beforePayment, which calls _handleStrategistInterestReward, the amount passed in is the amount of the lien (stack.point.amount), not the amount paid.

Tools Used

VSCode

Recommended Mitigation Steps

https://github.com/code-423n4/2023-01-astaria/blob/main/src/LienToken.sol#L819 I believe stack.point.amount should be changed to amount.

androolloyd (Astaria) commented:

Since we track payments against the principle via stack.point.amount, then you want to ensure that what were sending them is the correct amount. Lien data doesnt track the balance of a loan, only the max value a lien can have.

SantiagoGregory (Astaria) acknowledged

Picodes (judge) commented:

stack.point.amount, which represents the remaining debt amount should be replaced by the amount actually paid to mitigate this attack.


The original report as published on Code4rena, by evan. 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 reward function was passed the lien's remaining amount instead of the payment amount, so the reward was computed from the wrong figure.

Impact

The strategist could be paid more than they are supposed to, and could trigger this by making a tiny payment on behalf of the borrower even when the borrower has paid nothing.

What the attacker needed

Strategist role on a public vault; borrower has an active lien

The fix

The amount passed to the reward calculation should be the amount actually paid rather than the lien's remaining amount.

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 strategist is someone who helps run a lending vault and earns a reward based on the interest borrowers pay. The code was meant to reward them only for interest actually collected, but it looked at the total remaining debt instead, so a tiny payment could trigger a much larger reward.

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 evan

View all

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