A router swap is executed with an amountOutMin of 0 (or no minimum at all). Any searcher can sandwich the transaction: buy before it, let it execute at a worse price, and sell after, extracting the difference from the user.
// Mempool sandwich // 1. front-run: attacker buys, pushing price up // 2. victim swap runs with amountOutMin = 0, fills at the inflated price // 3. back-run: attacker sells, pocketing the spread (victim eats the loss)
uint256 minOut = quote * (10000 - slippageBps) / 10000; router.swapExactTokensForTokens(amountIn, minOut, path, to, deadline);
The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0104 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.