The swap
function is passing block.timestamp
to the Uniswap swap function, which means that whenever the miner decides to include the transaction in a block, it will be valid at that time, since block.timestamp
will be the current timestamp.
A malicious miner can hold the transaction, which may be being done in order to free up capital to ensure that there are funds available to do operations to prevent a liquidation. It is highly likely that a liquidation is more profitable for a miner to mine, with its associated follow-on transactions, than to allow the decrease of liquidity. A miner can also just hold it until maximum slippage is incurred.
Using block.timestamp
in the swap function as the deadline for the swap is risky. A malicious miner could hold the transaction, which could lead to loss of funds for the user.
Refer to this article : https://github.com/code-423n4/2022-11-paraspace-findings/issues/429
Victim could lose funds
Manual review
Add deadline argument to the swap
function which would allow users to pass the deadline, instead of including block.timestamp
. The fix is shown below
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.