A sandwich attack is a specific form of MEV in which the attacker:
- Sees a pending swap that will move the price (e.g., a large buy of token X).
- Submits their own buy of X with a higher priority fee, executing first.
- Lets the victim's transaction execute next, paying a higher price because of step 2.
- Submits a sell of X immediately after, capturing the price impact.
The victim experiences the attack as higher slippage than expected. The attacker captures the difference between the victim's executed price and the price that would have prevailed without the attack.
Defenses are operational:
- Slippage tolerance set to a real number (0.5–1%, not 50%).
- Private mempool routing so the swap isn't visible before inclusion.
- Trading on protocols with batched auctions rather than per-trade pricing.
A user who sets 50% slippage in a DEX UI is paying the maximum extractable value to MEV bots on every trade.