IV3SwapRouter
of the swap-router-contracts
lib lacks deadline checks which can cause timing execution issues
#601
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-24
insufficient quality report
This report is not of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2024-01-decent/blob/011f62059f3a0b1f3577c8ccd1140f0cf3e7bb29/src/swappers/UniSwapper.sol#L129-L135
https://github.com/code-423n4/2024-01-decent/blob/011f62059f3a0b1f3577c8ccd1140f0cf3e7bb29/src/swappers/UniSwapper.sol#L149-L156
https://github.com/code-423n4/2024-01-decent/blob/011f62059f3a0b1f3577c8ccd1140f0cf3e7bb29/src/swappers/SwapParams.sol#L9-L20
Vulnerability details
Impact
The protocol uses the
IV3SwapRouter
of theswap-router-contracts
lib rather than using the swap functions defined in theSwapRouter
contarct of thev3-periphery
lib of UniswapV3 protocol. The key difference between both, is that UniswapV3 uses the modifiercheckDeadline
before calling any swap functions CheckDeadline. Plus, the UniswapV3 has a deadline parameter defined for the structExactInputSingleParams
unlike theswap-router-contracts
.However, the absence of the
checkDeadline
modifier and the deadline parameter, can lead to issues related to the timing of swap executions. In Automated Market Maker (AMM) systems, front-running and transaction timing are critical. Without deadline checks, transactions could be manipulated by validators or miners to occur at times that are unfavorable to users or the protocol, potentially causing maximum slippage or other forms of transaction manipulation.Proof of Concept
In the UniSwapper contract, the library used lacks the checkDeadline modifier present in UniswapV3's SwapRouter contract. This modifier is crucial for enforcing a deadline on swap transactions:
Without this check, swap transactions lack a crucial safeguard against timing manipulation.
Tools Used
Manual review
Recommended Mitigation Steps
Use the functions defined in the
SwapRouter
contract of thev3-periphery
lib of UniswapV3 protocol instead. With this library used, theSwapParams
struct needs to be updated to account for the deadline parameter which should also be chosen by the user or detemined off-chain.Assessed type
Uniswap
The text was updated successfully, but these errors were encountered: