MorpheusAI

MorpheusAI
Foundry
22,500 USDC
View results
Submission Details
Severity: medium
Invalid

No deadline checks when making AMM swaps

Summary

The protocol uses block.timestamp for deadline, which defeats the purpose of a deadline.

Vulnerability Details

Interactions with uniswap are conducted require a deadline. This helps to limit the execution of pending transactions and discard expired transactions.
The swap function,

ISwapRouter.ExactInputSingleParams memory swapParams_ = ISwapRouter.ExactInputSingleParams({
tokenIn: params_.tokenIn,
tokenOut: params_.tokenOut,
fee: params_.fee,
recipient: address(this),
deadline: block.timestamp, //@note
amountIn: amountIn_,
amountOutMinimum: amountOutMinimum_,
sqrtPriceLimitX96: params_.sqrtPriceLimitX96
});

and the increaseLiquidityCurrentRange functions interact with uniswap, using block.timestamp as the deadline, which is ineffective as the check for deadline will compare the time the transaction was mined against itself.

INonfungiblePositionManager.IncreaseLiquidityParams memory params_ = INonfungiblePositionManager
.IncreaseLiquidityParams({
tokenId: tokenId_,
amount0Desired: amountAdd0_,
amount1Desired: amountAdd1_,
amount0Min: amountMin0_,
amount1Min: amountMin1_,
deadline: block.timestamp
});

Thus, malicious miners and MEV bots can hold the transaction for longer time periods and in many cases to the detriment of the owner.

Impact

The transaction will be left as pending in mempool for a longer time. The trade transaction can also be executed in a long time after the owner has submitted the transaction, at which, the trade can be done in a sub-optimal price, which harms owner's position, or be used to steal positive slippage from the owner.
A proper deadline check ensure that the transaction can be executed on time and the expired transaction revert.

Tools Used

Manual code review

Recommendations

Allow the owner to enter the needed deadline, by including a deadline parameter in the swap and increaseLiquidityCurrentRange functions.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Protocol should not use block.timestamp as deadline in Uniswap interactions because it renders the protection mechanism useless

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.