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

blockdev - Uniswap trades are not slippage protected #37

Closed
sherlock-admin opened this issue May 23, 2023 · 0 comments
Closed

blockdev - Uniswap trades are not slippage protected #37

sherlock-admin opened this issue May 23, 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 May 23, 2023

blockdev

high

Uniswap trades are not slippage protected

Summary

USSD contract makes trades on Uniswap via its swap router. The amountOutMinimum is set to 0 which means the trade will be successful even if it results in 0 amount of output token. This will lead to heavy sandwiching and frontrunning attacks leading to guaranteed loss making trades for USSD.

Vulnerability Detail

USSD.UniV3SwapInput() creates trade data and calls Uniswap router with amountOutMinimum set to 0.

IV3SwapRouter.ExactInputParams memory params = IV3SwapRouter
.ExactInputParams({
    path: _path,
    recipient: address(this),
    //deadline: block.timestamp,
    amountIn: _sellAmount,
    amountOutMinimum: 0 // <-- problematic value
});

Impact

High. 100% of the Uniswap trades will result in gaining 0 or dust amount of the output token.

Code Snippet

IV3SwapRouter.ExactInputParams memory params = IV3SwapRouter
.ExactInputParams({
    path: _path,
    recipient: address(this),
    //deadline: block.timestamp,
    amountIn: _sellAmount,
    amountOutMinimum: 0 // <-- problematic value
});

Tool used

Manual Review

Recommendation

Determine a suitable slippage percentage and calculate the minimum amount of output token expected. Set amountOutMinimum to that expected amount.

Duplicate of #673

@github-actions github-actions bot closed this as completed Jun 5, 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 Jun 5, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Jun 23, 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