FraudCodex FraudCodex
Market Abuse Crypto & Digital Assets

Sandwich Attacks & Abusive MEV

How MEV bots front-run and back-run DEX swaps to extract value from users, and how analysts detect it.

Last reviewed

1 Introduction

A sandwich attack is the best-known form of abusive maximal extractable value (MEV) on public blockchains. A bot watching pending transactions spots a large swap on an automated market maker (AMM), places its own buy just before it and a sell just after it in the same block, and so forces the victim to trade at a worse price. As long as the price impact stays inside the slippage tolerance the victim set, the trade still executes, and the difference ends up with the bot and the block builder it pays for priority.

The attack is possible because the order of transactions inside a block is chosen by block builders and validators, not by arrival time. ESMA's July 2025 risk analysis defines MEV as the value that builders, proposers or validators can extract by changing, inserting or censoring transactions in a block, and its guidelines on market abuse supervision under MiCA list MEV strategies among conduct that could constitute market abuse.

$25M

Taken from sandwich bots in about 12 seconds in the April 2023 exploit charged by the DOJ

Jul 2025

ESMA risk analysis on MEV and its implications for crypto markets

Public

Mempool where pending swaps are visible before inclusion

2 Interactive Sandwich Attack Walkthrough

Phase: Swap Submitted

Transaction Ordering

Value Transfer (illustrative)

Step 1 - Swap Submitted: A user submits a large swap to buy a token on an AMM with a 3% slippage tolerance. The transaction waits in the public mempool, visible to anyone running a node.

3 Detailed Analysis

Sandwich Attacks vs. Related Conduct

Sandwich attack

Trades placed immediately before and after a visible user swap in the same block, profiting from the price impact the user is forced to absorb.

Classic front-running

In traditional markets, a broker trading ahead of a customer's block order using knowledge of that order. FINRA Rule 5270 prohibits it for member firms.

Benign MEV

Arbitrage between pools and liquidations of under-collateralised loans also reorder transactions but do not directly worsen a specific user's execution.

Bot-on-bot exploits

Attacks that target sandwich bots themselves, such as the bait-transaction scheme behind the Peraire-Bueno prosecution.

Legal & Regulatory Framework

In the EU, MiCA (Regulation (EU) 2023/1114) prohibits insider dealing (Art. 89) and market manipulation (Art. 91) in crypto-assets within the scope of its market abuse title, and ESMA's 2025 supervisory guidelines name MEV strategies as conduct that could constitute market abuse. ESMA's MEV risk analysis also notes that MiCA is not intended to directly regulate DeFi, so sandwiching on a fully decentralised AMM can sit outside direct supervision while still affecting MiCA-regulated markets.

In the US there is no MEV-specific rule. Prosecutors in the Southern District of New York charged the Peraire-Bueno brothers with wire fraud (18 U.S.C. §1343) and money laundering conspiracy, but in November 2026 the court entered a judgment of acquittal, finding no material misrepresentation in conduct carried out on what the judge called a trustless, adversarial network. That outcome leaves the legal status of aggressive transaction ordering largely unsettled.

Detection Methodology

Sandwiches leave a clear on-chain signature: within one block and one pool, an address buys immediately before a user's swap and sells the same asset immediately after it. Analysts scan blocks for this buy-victim-sell triplet, compute the victim's realised price against the pre-trade quote, and link bot contracts through shared funding, builder tips and contract bytecode.

On the defensive side, wallets and venues reduce exposure with private order flow or protected RPC endpoints that keep swaps out of the public mempool, tight slippage limits, batch auctions and routing that is aware of MEV. Crypto-asset service providers that route client orders to DEXs can monitor execution quality for systematic slippage consistent with sandwiching.

Notable Cases

United States v. Peraire-Bueno (2024-2026) - DOJ, S.D.N.Y., United States

Two brothers were charged in May 2024 over an April 2023 exploit in which bait transactions lured sandwich bots and a relay flaw let them see the bots' bundles and swap out the bait, taking about $25 million in roughly 12 seconds. A November 2025 trial ended in a mistrial, and in November 2026 Judge Jessica Clarke granted a judgment of acquittal on all counts.

jaredfromsubway.eth (2023) - On-chain analytics, Ethereum

A pseudonymous bot that began running sandwich attacks in February 2023 became one of the biggest gas spenders on Ethereum during the spring 2023 memecoin boom. Analytics firm EigenPhi estimated about $40.6 million in revenue but only around $6.3 million in profit in under three months, because most of the take went on gas and builder payments.

Aguilar v. Baton Corp. (2025) - U.S. District Court, S.D.N.Y.

A consolidated amended class action filed in July 2025 against the operator of the Pump.fun launchpad added RICO claims and named Solana and Jito executives, alleging that MEV bundling gave insiders priority over ordinary buyers. The allegations are unproven and contested.

Red Flags

  • Swaps repeatedly filled at the edge of the user's slippage tolerance
  • The same address buying directly before and selling directly after a user's trade in one block
  • Large swaps in thin pools submitted through the public mempool with wide slippage settings
  • Bot contracts paying unusually high builder tips relative to the size of the trades they wrap
  • Execution quality for routed client orders consistently worse than the quoted price on DEX venues

4 Sources & Further Reading

Related Fraud Types