Cointegrity

Sandwich Attacks

Web3 / defi

Sandwich attacks are a form of Maximal Extractable Value (MEV) exploitation where an attacker observes pending transactions in the memory pool and strategically places their own transactions immediately before and after a victim's transaction to profit from predictable price movements. The attacker typically front-runs a large trade by buying tokens before the victim's transaction executes, then back-runs by selling those same tokens after the victim's transaction drives the price up, capturing the profit differential. This practice extracts value directly from users, who execute at worse prices than they would have without the attack. Sandwich attacks are particularly common on decentralized exchanges with public memory pools, making them a significant pain point for DeFi users and developers working on solutions like private transaction pools. Example: During the 2021 DeFi boom, MEV Bot Jaredfromsubway detected a large pending swap of ETH for USDC on Uniswap, inserted a transaction buying ETH ahead of it, and sold after the victim's transaction, profiting thousands of dollars from the price movement induced by the victim's own trade. Why it matters for DeFi: Sandwich attacks represent a hidden cost that degrades DeFi user experience and capital efficiency. Addressing MEV through solutions like encrypted mempools, threshold encryption, and fair-ordering services is critical for DeFi's competitiveness against centralized exchanges.

Category: defi, wallets security

Explore the full Web3 Glossary — 2,062+ expert-curated definitions. Need guidance? Talk to our consultants.