Skip to content
medium MEV / Ordering No SWC entry CWE-20

Swap Path / Route Validation Missing

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

What goes wrong

A swap accepts a caller-supplied token path without validating endpoints, letting an attacker route through malicious or worthless pools, or end in the wrong token.

2

How to fix it

the pattern that is safe
require(path[0]==tokenIn && path[path.length-1]==tokenOut, "bad path");
router.swapExactTokensForTokens(amt, minOut, path, to, dl);
Validate swap path endpoints.
Check your own contract for this

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