AuraSpell#closePositionFarm requires users to swap all reward tokens through same router
The AuraSpell contract's closePositionFarm function forces all reward tokens to be swapped through a single UniswapV2 router. This can cause users to suffer losses if that router lacks good liquidity for some tokens.
Source: https://github.com/sherlock-audit/2023-04-blueberry-judging/issues/122
Found by
0x52
Summary
AuraSpell#closePositionFarm requires users to swap all reward tokens through same router. This is problematic as it is very unlikely that a UniswapV2 router will have good liquidity sources for all tokens and will result in users experiencing forced losses to their reward token.
Vulnerability Detail
for (uint256 i = 0; i < rewardTokens.length; i++) {
uint256 rewards = _doCutRewardsFee(rewardTokens[i]);
_ensureApprove(rewardTokens[i], address(swapRouter), rewards);
swapRouter.swapExactTokensForTokens(
rewards,
0,
swapPath[i],
address(this),
type(uint256).max
);
}
All tokens are forcibly swapped through a single router.
Impact
Users will be forced to swap through a router even if it doesn't have good liquidity for all tokens
Code Snippet
Tool used
Manual Review
Recommendation
Allow users to use an aggregator like paraswap or multiple routers instead of only one single UniswapV2 router.
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
Impact
Users could be forced to swap through a router that lacks good liquidity for some tokens, leading to forced losses on their reward tokens.
What the attacker needed
User has a farming position with reward tokens
The fix
The contract should allow users to use an aggregator like Paraswap or multiple routers instead of only one single UniswapV2 router.
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 farming position, the contract automatically swaps your reward tokens into the token you want. This report says the contract always uses the same swapping service (router) for every token, even if that service gives a bad price for some tokens, so you might lose money.
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.