Web3 Dictionary Logo
Web3 Dictionary
Contribute

Categories

AllBlockchainDappsDAOsDeFiNFTsRegulationSecuritySmart ContractsTokenomicsWalletsWeb3 GamingOthers
  1. Web3 Dictionary
  2. Security
  3. Sandwich Attack
Security

Sandwich Attack

A front-running variant where an attacker places transactions before and after a victim's to manipulate price and profit.

Last Updated

2026-03-19

Related Concepts

Front-RunningMaximal Extractable ValueExploitDeFi
Web3-Explorer Logo

Web3 Security

AD

Security frameworks, smart contract reviews, and compliance alignment to reduce risk and protect users.

Review Security Services

What is Sandwich Attack?

A sandwich attack is a front-running exploit where an attacker inserts their own transactions directly before and after a victim's trade. The attacker profits by manipulating the price at the victim's expense.

How does Sandwich Attack work?

  1. A user broadcasts a large token swap to the mempool.
  2. The attacker buys the same token first with a higher gas fee, pushing the price up.
  3. The victim's trade executes at the inflated price.
  4. The attacker immediately sells at the now-higher price, capturing the spread.

Why does Sandwich Attack matter?

It costs users millions in worse execution prices annually. Every large DEX trade is a potential target, creating an invisible tax on retail traders.

Key features of Sandwich Attack

  • Exploits the public mempool and predictable AMM pricing
  • More profitable than simple front-running
  • Disproportionately affects large trades in low-liquidity pools
  • Mitigated by tight slippage limits and private mempools like Flashbots Protect

Examples of Sandwich Attack

A user swapping 1000 ETH on Uniswap could lose several percent of value to a sandwich bot. Setting slippage tolerance to 0.1 percent makes the attack unprofitable and causes the bot to skip the transaction.

External References

  • MEV Explained
  • Ethereum Transactions