qbs
high
The UniV3SwapInput
function in the USSD contract contains two vulnerabilities: a missing deadline check and a hardcoded slippage value.
-
Missing deadline check: The
UniV3SwapInput
function prepares anExactInputParams
struct to be passed as an argument to the Uniswap router's exactInput function. However, the code comments out the assignment of the deadline value in the struct, resulting in a revert on the exactInput call. -
Hardcoded slippage value: The
exactInput
function of the Uniswap router receive aamountOutMinimum
parameter that specifies the minimum acceptable amount of output tokens in a swap. In theUniV3SwapInput
function, this value is hardcoded to 0. Setting a slippage value of 0 means that the user accepts any output token amount, exposing them to potential losses through manipulative MEV (Miner Extractable Value) bot sandwich attacks.
function UniV3SwapInput(
bytes memory _path,
uint256 _sellAmount
) public override onlyBalancer {
IV3SwapRouter.ExactInputParams memory params = IV3SwapRouter
.ExactInputParams({
path: _path,
recipient: address(this),
//deadline: block.timestamp,
amountIn: _sellAmount,
amountOutMinimum: 0
});
uniRouter.exactInput(params);
}
Manual Review
Allow users to define their own deadline and amountOutMinimum parameters" check grammar correctness