Sandwich Attack

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: The information on this page may have been obtained from third parties and does not necessarily reflect the views or opinions of KuCoin. This content is provided for general informational purposes only, without any representation or warranty of any kind, nor shall it be construed as financial or investment advice. KuCoin shall not be liable for any errors or omissions, or for any outcomes resulting from the use of this information. Investments in digital assets can be risky. Please carefully evaluate the risks of a product and your risk tolerance based on your own financial circumstances. For more information, please refer to our Terms of Use and Risk Disclosure.