Skip to content
Business logic Audit finding Intermediate

Users can avoid performance fees by withdrawing before the end of the epoch forcing other users to pay their fees

The vault's performance fee calculation includes the value of early withdrawals, so users who withdraw before the epoch ends avoid paying the fee while the fee is still taken from the vault, reducing the share price for remaining users. This forces other users to pay the fees for those who withdrew early.

0x52 Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-09-knox-judging/issues/75

Found by

0x52

Summary

No performance fees are taken when user withdraws early from the vault but their withdrawal value will be used to take fees, which will be taken from other users.

Vulnerability Detail

uint256 adjustedTotalAssets = _totalAssets() + l.totalWithdrawals;

if (adjustedTotalAssets > l.lastTotalAssets) {
    netIncome = adjustedTotalAssets - l.lastTotalAssets;

    feeInCollateral = l.performanceFee64x64.mulu(netIncome);

    ERC20.safeTransfer(l.feeRecipient, feeInCollateral);
}

When taking the performance fees, it factors in both the current assets of the vault as well as the total value of withdrawals that happened during the epoch. Fees are paid from the collateral tokens in the vault, at the end of the epoch. Paying the fees like this reduces the share price of all users, which effectively works as a fee applied to all users. The problem is that withdraws that take place during the epoch are not subject to this fee and the total value of all their withdrawals are added to the adjusted assets of the vault. This means that they don't pay any performance fee but the fee is still taken from the vault collateral. In effect they completely avoid the fee force all there other users of the vault to pay it for them.

Impact

User can avoid performance fees and force other users to pay them

Code Snippet

VaultInternal.sol#L504-L532

Tool used

Manual Review

Recommendation

Fees should be taken on withdrawals that occur before vault is settled

Discussion

0xCourtney

https://github.com/KnoxFinance/knox-contracts/pull/87

rcstanciu

Reply from @arbitrary-CodeBeholder


looks good

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

The fee calculation adds the total value of withdrawals during the epoch to the vault's assets, so early withdrawers' profits are counted for the fee but they are not charged, and the fee is taken from the remaining pool.

Impact

A user can avoid performance fees and force other users to pay them.

What the attacker needed

A vault with performance fees; ability to withdraw before epoch ends

The fix

Fees should be taken on withdrawals that occur before the vault is settled.

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 pool where people deposit money. A performance fee is a cut taken when the pool earns a profit. The bug lets someone take their money out early and skip the fee, but the fee is still charged to the pool, so everyone else pays more.

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

View all

211 more disclosed reports, best first.

More from Knox Finance

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.