What are Sandwich Attacks?



Blog post image.

A sandwich attack is a form of Maximal Extractable Value (MEV) exploitation where an attacker front-runs and back-runs a user’s trade to profit from price movement. Here are some terms you should know before we proceed:

  • MEV: The maximum value that can be gained by reordering, inserting, or censoring transactions within a block
  • Mempool: A waiting area where verified but unconfirmed transactions are stored until they are included in a block
  • Front-Run: Placing a transaction before a large transaction to profit from the subsequent price increase.
  • Back-Run: Placing a transaction after a large transaction to profit from the price changes.

In this guide, let’s understand how they work and learn how BNB Chain protects its users from this attack vector.

How Does a Sandwich Attack Work?

Let’s look at a basic attack:

  • An attacker monitors the mempool for a high-value transaction.
  • Following detection, the attacker places two transactions around it – one before (front-run) and one after (back-run).
  • By front-running, the attacker buys the asset before the victim’s trade execution, increasing its price. To front-run, the attacker pays very high gas fees to get selected over the victim.
  • Once the victim’s transaction goes through at the inflated price, the attacker immediately sells the asset at a profit. 

End Goal: The attacker forces the victim to buy at a worse rate while the attacker capitalizes on the artificial price movement.

This attack is commonly seen in decentralized exchanges that use automated market makers (AMMs). AMMs are majorly dependent on liquidity pools, and sudden price shifts can greatly impact overall trade execution.

As you can understand, the implications of these attacks are quite extreme. They distort trades for everyday retail users, making DeFi markets less attractive for honest traders.

More Sandwich Attack Strategies

Here are some more sandwich attack strategies, as shown in “A Study on Blockchain Sandwich Attack Strategies Based on Mechanism Design Game Theory.”

Liquidity Manipulation Attack

  • The attacker temporarily removes liquidity from the pool before the victim’s trade.
  • The victim’s transaction executes with increased price slippage, making them pay even more.
  • The attacker restores liquidity after the victim’s trade, preventing market corrections.
  • It can be combined with a standard sandwich attack for higher efficiency.

Multi-Step Arbitrage Strategy

  • The attacker detects a profitable sandwich opportunity on multiple DEXs.
  • Instead of a simple front-run/back-run, they execute a series of trades across liquidity pools.
  • Profits are extracted across different assets, pools, and exchanges.
  • Maximizes MEV extraction across multiple platforms.
  • Increases complexity but yields higher profits than a standard sandwich attack.

Targeting Low-Liquidity Pools

  • Attackers scan for transactions in small liquidity pools where price impact is higher.
  • A small purchase significantly affects the price, making sandwiching highly profitable.
  • This attack requires less capital than attacking high-liquidity pools.
  • More effective in lesser-known DEXs or on newly launched tokens.

Slippage-Based Adaptive Attacks

  • Attackers monitor slippage settings of pending trades. They prioritize transactions with higher slippage tolerances, as these allow for greater price manipulation.
  • If slippage is too low, they may ignore the transaction or adjust their attack. This reduces the risk of failed transactions.

AI-Powered Sandwich Attacks

  • Attackers use machine learning models to predict optimal sandwich opportunities.
  • AI bots analyze the trading volume, slippage tolerance, and mempool transactions in real time.
  • The bot automates and optimizes sandwich attack execution.
  • Highly efficient and adaptable, reducing manual intervention.

How BNB Chain Helps Reduce Sandwich Attacks

BNB Chain has implemented multiple measures to protect traders from sandwich attacks.

Proposer-Builder Separation and Mempool Security

BNB Chain has strengthened its block proposal and validation process.

  • Proposer-Builder Separation (PBS): This architecture outsources block building to multiple competitive builders, preventing validators from potentially manipulating transaction ordering.
  • Mempool Protection: BSC validators are working together to reduce mempool exposure to bad actors. Less exposure = Less opportunities for MEV attacks.

Wallet-Based MEV Protection

BNB Chain has partnered with the following major wallet providers to integrate built-in MEV protection, allowing users to transact securely without additional setup:

  • Binance Wallet
  • Trust Wallet
  • OKX Wallet
  • TokenPocket

Learn how to set it up here.

Private RPC Services

For users with wallets that do not offer native MEV protection – such as MetaMask – BNB Chain supports manual protection via private RPC (Remote Procedure Call) services. Currently, BNB Chain has the following free private RPC services:

Advanced MEV Protection for Developers and Professionals

For institutional traders and Dapp developers, BNB Chain offers customizable MEV protection solutions through third-party service providers.

Service ProviderFeaturesPricing
BloxRouteHigh-performance private transaction protectionMonthly subscription
BlocksmithPrivate transactions with atomic bundlingMonthly subscription
NoderealAPI services for private transactionsFree tier available
BlockrazorCustom RPC servicesContact provider
PuissantPrivate communication for BSC users and validatorsContact provider

The BNB Chain community remains committed to eliminating malicious MEV attack vectors. As mentioned in the 2025 roadmap, reducing MEV attacks is a top priority for the BNB Chain core team, with a key focus on cutting block times to under 1 second, minimizing the window for exploitation. Through ongoing infrastructure improvements and innovation, BNB Chain continues to enhance security and fairness for all users.