Users are forced to swap all reward tokens with no slippage protection
AuraSpell swaps all reward tokens to a debt token without allowing users to set a minimum output amount, so the swap can be sandwiched and the rewards stolen.
Source: https://github.com/sherlock-audit/2023-04-blueberry-judging/issues/121
Found by
0x52, Bauer, Breeje, J4de, ctf_sec, n1punp, nobody2018
Summary
AuraSpell forces users to swap their reward tokens to debt token but doesn't allow them to specify any slippage values.
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
);
}
Above all reward tokens are swapped and always use 0 for min out meaning that deposits will be sandwiched and stolen.
Impact
All reward tokens can be sandwiched and stolen
Code Snippet
Tool used
Manual Review
Recommendation
Allow user to specify slippage parameters for all reward tokens
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 hardcodes a minimum output of zero for token swaps, providing no slippage protection.
Impact
All reward tokens can be sandwiched and stolen.
What the attacker needed
None
The fix
The contract should allow users to specify slippage parameters for all reward token swaps.
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 a contract swaps tokens, it can set a minimum amount to receive to protect against price changes. Here, the contract sets that minimum to zero, so an attacker can manipulate the price and take the difference.
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.