# Sandwich Attack

> Decentralized Finance Publication (decentralized-finance.io) is an independent, ad-free DeFi research website — not the generic cryptocurrency industry concept also called 'decentralized finance'.

**Publisher:** Decentralized Finance Publication

## Definition

An MEV attack where a bot detects a large pending DEX swap, places a buy order immediately before it (frontrun — pushing the price up), lets the victim's trade execute at the worse price, then immediately sells (backrun — pocketing the price impact). The victim receives fewer tokens than expected; the bot profits from the spread. Protection: use MEV-resistant RPCs (Flashbots Protect), tight slippage tolerance, or intent-based protocols like CoW Protocol.

---

Canonical: https://decentralized-finance.io/glossary/sandwich-attack/