Skip to content
Business logic Audit finding Intermediate

Users can avoid paying vault fees

The vault's fee-charging logic skips minting LP fees when the time since the last fee charge is below a configured delay. An attacker could deposit a tiny amount to trigger a fee charge, then deposit a large amount, earn interest, and withdraw before the delay elapses, paying no fees on the large position.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

The LPIssuer.deposit/withdraw function charges protocol&management&performance fees through inflating the LP supply in the _chargeFees function. However, this LP fees minting is skipped if the elapsed time is less than the managementFeeChargeDelay:

if (elapsed < vg.delayedProtocolParams().managementFeeChargeDelay) {
    return;
}

This allows a user to avoid paying any fees if they deposit right after a charge fee interaction and withdraw within again managementFeeChargeDelay time period.

Proof Of Concept

This can be abused heavily on networks where the gas fees are a lot cheaper than the three vault fees:

  • deposit a tiny amount just to trigger the charge fees. This sets lastFeeCharge
  • deposit a huge amount, tvl increases significantly
  • let it earn interest. withdraw it before the managementFeeChargeDelay. No fees are paid, tvl reduces significantly
  • repeat, fees are only paid on tiny tvl

Impact

In the worst case, nobody pays fees by repeating the above actions.

Recommended Mitigation Steps

Fees must always be charged on each deposit and withdrawal, even within the same block as it could be that a huge interest “harvest” comes in that an attacker sandwiches. Remove the if (elapsed < vg.delayedProtocolParams().managementFeeChargeDelay) { return; } code.

MihanixA (Mellow Protocol) disputed:

Charging fees on every deposit costs a lot of gas. If we notice users avoid paying fees we would just switch managementFeeChargeDelay to zero.

0xleastwood (judge) commented:

I don’t think this is a valid reason. At the end of the day, users can still abuse this feature and it is best to think about worse case scenario. I’ll keep this issue as high severity unless there is any reason not to? @MihanixA

MihanixA (Mellow Protocol) commented:

@0xleastwood Notice that users funds are not at risk and we can not remove this behaviour because this would lead to high withdraw/deposit fees. Anyway feel free to mark this issue anything seems fair to you.

0xleastwood (judge) commented:

While I understand funds aren’t directly at risk. It does seem like this issue can be exploited to earn additional yield at a lower opportunity cost as the user does not pay fees.

I think I’ll mark this as medium then.

2 — Med (M): vulns have a risk of 2 and are considered “Medium” severity when assets are not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.

The original report as published on Code4rena, by cmichel. 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 fee-charging function returns early without minting fees when the elapsed time since the last charge is less than the configured delay, so a small deposit can reset the timer and shield a subsequent large deposit and withdrawal from fees.

Impact

In the worst case, nobody pays fees by repeating the actions, allowing users to earn additional yield at a lower opportunity cost; funds are not directly at risk.

What the attacker needed

Ability to deposit and withdraw; gas fees cheaper than vault fees; attacker can act within the delay window

The fix

Fees should always be charged on each deposit and withdrawal, even within the same block, by removing the early return when the elapsed time is below the delay.

How it was found

  1. Deposit a tiny amount to trigger the fee charge and set the last fee charge timestamp.
  2. Deposit a large amount, significantly increasing the total value locked.
  3. Let the large deposit earn interest.
  4. Withdraw the large amount before the management fee charge delay elapses, paying no fees.
  5. Repeat the process so fees are only ever paid on the tiny 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 vault is a shared pot where people put money and earn interest. The vault takes a small cut (fees) when people add or remove money, but only if enough time has passed since the last cut. The report says someone can reset that timer with a tiny deposit, then move a large amount in and out quickly to avoid the cut on the large amount.

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 cmichel

View all

196 more disclosed reports, best first.

More from Mellow Protocol 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.