AuraSpell#closePositionFarm will take reward fees on underlying tokens when borrow token is also a reward
The closePositionFarm function in AuraSpell burns the BLP (liquidity provider) tokens before deducting the reward fee. If the borrow token is also a reward token, the fee is taken from the underlying liquidity, causing the user to lose more funds than intended.
Source: https://github.com/sherlock-audit/2023-07-blueberry-judging/issues/103
Found by
0x52
AuraSpell#AuraSpell#closePositionFarm will take reward fees on underlying tokens when borrow token is also a reward. This is because the BLP is burned before taking the reward cut.
Vulnerability Detail
wAuraPools.getVault(lpToken).exitPool(
IBalancerPool(lpToken).getPoolId(),
address(this),
address(this),
IBalancerVault.ExitPoolRequest(
tokens,
minAmountsOut,
abi.encode(0, amountPosRemove, borrowTokenIndex),
false
)
);
}
}
/// 4. Swap each reward token for the debt token
uint256 rewardTokensLength = rewardTokens.length;
for (uint256 i; i != rewardTokensLength; ) {
address sellToken = rewardTokens[i];
if (sellToken == STASH_AURA) sellToken = AURA;
_doCutRewardsFee(sellToken);
We can see above that closePositionFarm redeems the BLP before it takes the reward cut. This can cause serious issues. If there is any overlap between the reward tokens and the borrow token then _doCutRewardsFee will take a cut of the underlying liquidity. This causes loss to the user as too many fees are taken from them.
Impact
User will lose funds due to incorrect fees
Code Snippet
Tool used
Manual Review
Recommendation
Use the same order as ConvexSpell and sell rewards BEFORE burning BLP
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 contract burns the BLP tokens before deducting the reward fee, so the fee is applied to the underlying liquidity when the borrow token is also a reward token.
Impact
Users could lose funds because the fee is taken from their underlying liquidity instead of only from rewards.
What the attacker needed
Borrow token is also a reward token
The fix
The reward fee should be taken before burning the BLP tokens, following the same order as ConvexSpell.
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.
When you close a leveraged position, the contract first returns your liquidity pool tokens and then takes a fee from the reward tokens. If the token you borrowed is also a reward token, the fee is incorrectly taken from your own deposited funds, so you get less back than you should.
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.