Skip to content
high MEV / Ordering No SWC entry CWE-682

Sandwich Attack via Missing Slippage Protection

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

What goes wrong

A swap sets amountOutMin to 0 (or no slippage bound), so an attacker brackets the trade with buy/sell to force maximum slippage and extract value.

2

How to fix it

the pattern that is safe
router.swapExactTokensForTokens(amtIn, minOut, path, to, deadline);
// minOut from a trusted quote with slippage tolerance
Always set minOut and a deadline.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0058 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