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

Breeje - No Slippage Protection while Swapping tokens through uniswap router #58

Closed
sherlock-admin opened this issue Apr 30, 2023 · 0 comments
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

Breeje

high

No Slippage Protection while Swapping tokens through uniswap router

Summary

While Closing Position Farm in AuraSpell, convexSpell and curveSpell, there is a use of Uniswap Router which uses swapExactTokensForTokens method call to Swap rewards tokens to debt token. But the value of amountOutMinimum is set to be zero which allows 100% Value Slippage.

Vulnerability Detail

In closePositionFarm method of all the 3 spell contracts, there is no slippage control while swapping the reward tokens into debt tokens which means that a malicious actor could, e.g., trivially insert transactions before and after the naive transaction (using the infamous "sandwich" attack), causing the smart contract to trade at a radically worse price, profit from this at the caller's expense, and then return the contracts to their original state, all at a low cost.

Impact

Loss of Funds.

Code Snippet

File: AuraSpell.sol

  swapRouter.swapExactTokensForTokens(
      rewards,
      0,
      swapPath,
      address(this),
      type(uint256).max
  );

Link to Code

File: ConvexSpell.sol

  swapRouter.swapExactTokensForTokens(
      rewards,
      0,
      swapPath,
      address(this),
      type(uint256).max
  );

Link to Code

File: CurveSpell.sol

  swapRouter.swapExactTokensForTokens(
      rewards,
      0,
      swapPath,
      address(this),
      type(uint256).max
  );

Link to Code

Tool used

Manual Review

Recommendation

Use a require check at the end of swap to make sure that slippage is not higher than user allowed slippage.

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