Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Bauer - AuraSpell executes swaps without slippage protection #45

Closed
sherlock-admin opened this issue Apr 30, 2023 · 0 comments
Closed
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Apr 30, 2023

Bauer

high

AuraSpell executes swaps without slippage protection

Summary

The AuraSpell protocol executes swaps without slippage protection. That will cause a loss of funds because of sandwich attacks.

Vulnerability Detail

In AuraSpell .closePositionFarm() swaps are executed through the swapRouter.The amountOutMin value has been set to 0. Without slippage protection, this is vulnerable to sandwich attacks

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
            );
        }

Impact

Swaps will be sandwiched causing a loss of funds for users you withdraw their rewards.

Code Snippet

https://github.com/sherlock-audit/2023-04-blueberry/blob/main/blueberry-core/contracts/spell/AuraSpell.sol#L196-L202

Tool used

Manual Review

Recommendation

Calculate the maximum output and set slippage protection

Duplicate of #121

@github-actions github-actions bot closed this as completed May 3, 2023
@github-actions github-actions bot added High A valid High severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels May 3, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label May 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant