Sandwich Attack
What is Sandwich Attack?
Sandwich AttackA form of MEV in which an attacker places a buy order before a victim's pending swap and a sell order immediately after, profiting from the artificial price move they induce.
Sandwich attacks target swaps on automated market makers (AMMs) such as Uniswap, SushiSwap, or PancakeSwap. The attacker spots a large pending swap in the public mempool that will move the pool's price. They submit a front-running buy of the same asset with higher gas, the victim's swap then executes at a worse price because of the moved curve, and the attacker immediately back-runs with a sell at the new inflated price. The victim suffers extra slippage; the attacker pockets the difference minus gas. Defences include tight slippage tolerances, private order flow (Flashbots Protect, MEV-Share), batch auctions like CoW Swap, and routing aggregators that split orders.
● Examples
- 01
A whale executes a 5 million USDC to ETH swap on Uniswap V3 and a bot front-runs and back-runs it, extracting tens of thousands of dollars.
- 02
On BNB Chain, sandwich bots commonly target large PancakeSwap trades on low-liquidity pools.
● Frequently asked questions
What is Sandwich Attack?
A form of MEV in which an attacker places a buy order before a victim's pending swap and a sell order immediately after, profiting from the artificial price move they induce. It belongs to the Web3 & Blockchain category of cybersecurity.
What does Sandwich Attack mean?
A form of MEV in which an attacker places a buy order before a victim's pending swap and a sell order immediately after, profiting from the artificial price move they induce.
How does Sandwich Attack work?
Sandwich attacks target swaps on automated market makers (AMMs) such as Uniswap, SushiSwap, or PancakeSwap. The attacker spots a large pending swap in the public mempool that will move the pool's price. They submit a front-running buy of the same asset with higher gas, the victim's swap then executes at a worse price because of the moved curve, and the attacker immediately back-runs with a sell at the new inflated price. The victim suffers extra slippage; the attacker pockets the difference minus gas. Defences include tight slippage tolerances, private order flow (Flashbots Protect, MEV-Share), batch auctions like CoW Swap, and routing aggregators that split orders.
How do you defend against Sandwich Attack?
Defences for Sandwich Attack typically combine technical controls and operational practices, as detailed in the full definition above.
What are other names for Sandwich Attack?
Common alternative names include: AMM sandwich, Sandwich MEV.
● Related terms
- web3№ 675
MEV (Maximal Extractable Value)
The profit that block builders, validators, or searchers can extract by reordering, inserting, or censoring transactions within the blocks they produce.
- web3№ 435
Front-Running (Blockchain)
On-chain trade abuse where an actor sees a pending transaction in the mempool and submits their own transaction first to profit from the predictable price impact.
- web3№ 424
Flash Loan Attack
A DeFi exploit that borrows a massive uncollateralised flash loan within one transaction to manipulate prices or governance and steal funds before the loan is repaid.
- web3№ 765
Oracle Manipulation
An attack that distorts the price or data feed used by a smart contract so the contract makes wildly wrong decisions about lending, liquidations, or settlement.
- web3№ 1056
Smart Contract Security
The practice of designing, reviewing, and operating on-chain programs so they cannot be exploited to steal funds, freeze logic, or violate intended business rules.
- web3№ 106
Blockchain Security
The discipline of protecting distributed ledgers, their consensus mechanisms, smart contracts, and surrounding infrastructure from compromise, fraud, and theft.