Sandwich Attack

Beginner

A sandwich attack is a DeFi trading exploit where an attacker front-runs and back-runs a victim’s trade on a decentralized exchange (DEX), manipulating token prices to profit from price slippage.

 

What Is a Sandwich Attack?

A sandwich attack is a DeFi trading exploit where a malicious actor manipulates the price of a token by placing two transactions around a target trade to profit from price slippage. This attack typically occurs on DEXs using automated market makers (AMMs), such as Uniswap and PancakeSwap.

 

By front-running and back-running a trade, the attacker forces the victim to buy at a higher price and sell at a lower price, profiting from the artificially created price movement.

 

How Does a Sandwich Attack Work?

  1. Front-Running – The attacker detects a pending trade and places a buy order first, pushing the token’s price up.

  2. Victim’s Trade Executes – The victim’s order is processed at a higher price than expected.

  3. Back-Running – The attacker quickly sells the tokens at the inflated price, profiting from the manipulated trade.

This attack exploits MEV (Maximal Extractable Value), a practice where bots monitor mempools to detect profitable trade opportunities before they are confirmed on-chain.

 

Why Are Sandwich Attacks Important?

  1. Increases Trading Costs – Traders end up paying higher slippage due to price manipulation.

  2. Reduces Market Fairness – Creates an unfair advantage for attackers, harming retail traders.

  3. Highlights DeFi Vulnerabilities – Encourages the development of anti-MEV solutions like private mempools and slippage protection.

Sandwich attacks are a growing concern in DeFi trading, prompting developers to implement MEV-resistant strategies, such as transaction ordering protections and private transaction relays, to safeguard users.

Disclaimer: This general market information may come from third-party, commercial, or sponsored sources and is provided for informational and educational purposes only. It does not constitute financial or investment advice, an offer, a solicitation, or a guarantee. We assume no responsibility for the accuracy, completeness, or reliability of this information or for any losses arising from its use. Investing and trading involve risks. Past performance does not guarantee future results. Users should conduct their own research, exercise sound judgment, and take full responsibility for their decisions. For more information, please refer to KuCoin's Terms of Use and Risk Disclosure.