syncFeeCheckpoint() does not modify the highWaterMark correctly, sometimes it might even decrease its value, resulting in charging more performance fees than it should
The syncFeeCheckpoint modifier unconditionally overwrote the highWaterMark with the current share value, which could lower it below its previous level. This caused performance fees to be charged on gains that had already been accounted for, overcharging investors.
chaduke Follow with KIntern_NA, rbserver and 2 others
Originally disclosed on Code4rena
Submitted by chaduke, also found by KIntern_NA, rbserver, cccz, and cccz
syncFeeCheckpoint() does not modify the highWaterMark correctly, sometimes it might even decrease its value, resulting in charging more performance fees than it should.
Proof of Concept
The Vault.syncFeeCheckpoint() function does not modify the highWaterMark correctly, sometimes it might even decrease its value, resulting in charging more performance fees than it should. Instead of updating with a higher share values, it might actually decrease the value of highWaterMark. As a result, more performance fees might be charged since the highWaterMark was brought down again and again.
modifier syncFeeCheckpoint() {
_;
highWaterMark = convertToAssets(1e18);
}
- Suppose the current
highWaterMark = 2 * e18andconvertToAssets(1e18) = 1.5 * e18. - After
deposit()is called, since thedeposit()function has thesynFeeCheckpointmodifier, thehighWaterMarkwill be incorrectly reset to1.5 * e18. - Suppose after some activities,
convertToAssets(1e18) = 1.99 * e18. TakeFees()is called, then the performance fee will be charged, since it wrongly decidesconvertToAssets(1e18) > highWaterMarkwith the wronghighWaterMark = 1.5 * e18. The correcthighWaterMarkshould be2 * e18:
modifier takeFees() {
uint256 managementFee = accruedManagementFee();
uint256 totalFee = managementFee + accruedPerformanceFee();
uint256 currentAssets = totalAssets();
uint256 shareValue = convertToAssets(1e18);
if (shareValue > highWaterMark) highWaterMark = shareValue;
if (managementFee > 0) feesUpdatedAt = block.timestamp;
if (totalFee > 0 && currentAssets > 0)
_mint(feeRecipient, convertToShares(totalFee));
_;
}
function accruedPerformanceFee() public view returns (uint256) {
uint256 highWaterMark_ = highWaterMark;
uint256 shareValue = convertToAssets(1e18);
uint256 performanceFee = fees.performance;
return
performanceFee > 0 && shareValue > highWaterMark
? performanceFee.mulDiv(
(shareValue - highWaterMark) * totalSupply(),
1e36,
Math.Rounding.Down
)
: 0;
}
- As a result, the performance fee is charged when it is not supposed to do so. Investors might not be happy with this.
Tools Used
Remix
Recommended Mitigation Steps
Revise the syncFeeCheckpoint() as follows:
modifier syncFeeCheckpoint() {
_;
uint256 shareValue = convertToAssets(1e18);
if (shareValue > highWaterMark) highWaterMark = shareValue;
}
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 syncFeeCheckpoint modifier assigned the current share value to highWaterMark without checking whether it was higher than the existing mark.
Impact
Investors could be charged more performance fees than they should, because the highWaterMark was repeatedly lowered.
What the attacker needed
A vault with performance fees enabled; share value falls below the previous highWaterMark
The fix
The modifier should only raise highWaterMark when the current share value is higher than the existing mark.
How it was found
- Start with a highWaterMark of 2e18 and a current share value of 1.5e18.
- Call deposit(), which triggers the syncFeeCheckpoint modifier and resets highWaterMark to 1.5e18.
- After some activity, the share value rises to 1.99e18.
- Call takeFees(), which charges a performance fee because 1.99e18 exceeds the wrongly lowered highWaterMark of 1.5e18.
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 tracks a 'high water mark', the highest value a share has reached, so performance fees are only taken on new profits above that level. Here, a routine update reset that mark to whatever the current value was, even if lower, so later fees were charged on gains that had already been counted.
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.