Skip to content

Swap Deadline Set to block.timestamp

SAFE-0105 MEV / Ordering Checked automatically by the scanner
1

What goes wrong

A swap passes block.timestamp as its own deadline, which disables the deadline check entirely: whenever a validator finally includes the transaction the check is trivially satisfied. A pending swap can be held and released at the most profitable (for the attacker) moment.

2

The vulnerable pattern

proof of concept — how it is exploited
// tx sits in the mempool for hours; validator releases it when price is worst.
// require(block.timestamp <= block.timestamp) is always true -> no protection.
3

How to fix it

the pattern that is safe
// deadline must come from the caller, not the block being mined
router.swapExactTokensForTokens(amountIn, minOut, path, to, userDeadline);
Pass a caller-supplied deadline, never block.timestamp.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0105 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs